Sequence Permutations

Count how many distinct permutations of 1..N are reachable from the sorted order by exactly M adjacent swaps, modulo 1,000,000,009.

Medium6Dynamic programmingCombinatoricsSortingMathNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given the integer sequence A=[1,2,,N]A = [1, 2, \ldots, N]. You perform exactly MM swaps, where each swap exchanges the positions of two adjacent numbers.

Write a program that computes the number of distinct sequences that can result, modulo 10000000091\,000\,000\,009.

Input

The first line contains two integers NN and MM. (2N20002 \le N \le 2000, 0M20000 \le M \le 2000)

Output

Print, on the first line, the number of sequences that can result, modulo 10000000091\,000\,000\,009.