## A Math Contest P8 - Permutation Counting

View as PDF

Points: 12
Time limit: 1.0s
Memory limit: 512M

Author:
Problem types

Calculate the number of permutations of the first positive integers which can be sorted by performing exactly swaps of adjacent elements.

#### Input Specification

The only line contains two space-separated integers, and .

#### Output Specification

Output the number of permutations of the first positive integers which can be sorted by performing exactly adjacent swaps. Since this value may be large, output it modulo .

#### Sample Input

3 3

#### Sample Output

3

#### Explanation for Sample

The permutations of which can be sorted by performing exactly adjacent swaps are , and .