Submit solution

Points:
12 (partial)

Time limit:
0.6s

Memory limit:
64M

Problem type

Allowed languages

Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, ~~CommonLisp~~, D, Dart, F#, Forth, Fortran, Go, ~~Groovy~~, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, ~~Nim~~, ~~ObjC~~, OCaml, ~~Octave~~, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Consider a sequence of integers where each integer between and appears exactly once.

A pair of numbers in the sequence is **confused** if the number that comes earlier in the sequence is larger than the later number.

The **confusion** of the sequence is the number of confused pairs in it. For example, the confusion of the sequence is because there are confused pairs: , and .

Write a program that calculates the number of sequences of length whose confusion is exactly .

#### Input Specification

The first and only line of input contains two integers, and .

#### Output Specification

Output the number of sequences modulo .

#### Sample Input 1

`10 1`

#### Sample Output 1

`9`

#### Sample Input 2

`4 3`

#### Sample Output 2

`6`

#### Sample Input 3

`9 13`

#### Sample Output 3

`17957`

## Comments