Vera and Sorting

Count permutations of size N for which a recursive quicksort-like routine performs exactly K comparison steps, modulo 1e9+7.

Medium7Dynamic programmingCombinatoricsRecursionMathNo attempts yetTime limit2sMemory limit256 MB

Problem

Vera invented a new sorting algorithm. She wrote the Python function below to count how many steps her algorithm takes.

def steps(array):
    if len(array) == 0:
        return 0
    pivot = array[0]
    count = 0
    lesser = []
    greater = []
    for element in array:
        count += 1
        if element < pivot:
            lesser.append(element)
        elif element > pivot:
            greater.append(element)
    return count + steps(lesser) + steps(greater)

A permutation PP of size NN is an ordered sequence of integers P1,P2,,PNP_1, P_2, \dots, P_N whose NN entries are distinct positive integers, each of them at most NN.

You are given integers NN and KK. Count the permutations PP of size NN for which steps(P)steps(P) returns KK. The count can be large, so print it modulo 109+710^9 + 7.

Input

The first line contains two integers NN and KK separated by a space.

  • 1N301 \le N \le 30
  • 1K9001 \le K \le 900

Output

Print the number of such permutations modulo 109+710^9 + 7 on a single line.

Note

For N=3N = 3 and K=5K = 5 the two valid permutations are (2,1,3)(2, 1, 3) and (2,3,1)(2, 3, 1).