B-trees#5312

B-trees

5 seconds
64 megabytes
Very hard

If a tree could speak...

A B-tree is a data structure used for storing data in secondary memory, such as on a hard disk. It has the following properties:

  1. Each non-leaf node has at least children and at most children, where is a parameter known as the branching factor.

  2. Each leaf node contains a number of keys, from t-1 to 2t-1.

  3. The length of the path from the root to any leaf is the same for all leaves.

Note that the root node can also be a leaf.

Two B-trees are considered different if they differ as graphs with labeled vertices, or if a vertex with the same labels contains a different number of keys. For instance, there are distinct B-trees with keys and a branching factor of :

Determine the number of distinct B-trees that can be formed with keys in the leaves and a branching factor of .

Input

The first line contains two natural numbers and — the number of keys in the leaves and the branching factor, respectively (1 \leq n \leq 500, 2 \leq t \leq 10^9).

Output

Print a single number on the first line, without leading zeros: the number of B-trees with keys in the leaves and a branching factor of .

Examples

Example 1

Loading
Loading