Function

Count functions on {1..n} whose eventual image (the set of values reached after iterating long enough) has size exactly k, modulo 1e9+7.

Hard8CombinatoricsDynamic programmingMathGraphNo attempts yetTime limit2sMemory limit512 MB

Problem

In this problem, a function means a function that sends every integer from 1 to nn to an integer from 1 to nn. For example, when n=3n = 3, one possible function gg is g(1)=1g(1) = 1, g(2)=3g(2) = 3, g(3)=1g(3) = 1.

Define fj(x)f^j(x) as follows.

  • f0(x)=xf^0(x) = x for every valid xx.
  • fj+1(x)=fj(f(x))f^{j+1}(x) = f^j(f(x)) for every valid xx and jj.

The following notation is defined.

  • G(f,w)G(f, w) is the set of the values fr(x)f^r(x) taken over every xx with 1xn1 \le x \le n and every rr with rwr \ge w.
  • S(f,w)S(f, w) is the size of G(f,w)G(f, w).
  • Z(f)Z(f) is the minimum of S(f,w)S(f, w) over all nonnegative integers ww.
  • A(y)A(y) is the set of the functions ff with Z(f)=yZ(f) = y.

Given nn and kk, write a program that computes the size of A(k)A(k) modulo 1,000,000,007.

Input

The first line contains nn and kk, separated by a space. (1n50001 \le n \le 5000, 0kn0 \le k \le n)

Output

Print the size of A(k)A(k) modulo 1,000,000,007 on the first line.

Hint

For n=2n = 2 there are 4 functions in total. Call them aa, bb, cc, dd.

  • a(1)=1a(1) = 1, a(2)=1a(2) = 1
  • b(1)=1b(1) = 1, b(2)=2b(2) = 2
  • c(1)=2c(1) = 2, c(2)=1c(2) = 1
  • d(1)=2d(1) = 2, d(2)=2d(2) = 2

aa and dd belong to A(1)A(1), and bb and cc belong to A(2)A(2).