Presenters
View as PDFThe workshop needs a presenting sequence. There are distinct people, and you must choose
exactly
of them to present. Order matters: the person in slot
speaks first, the person in
slot
speaks second, and so on. The same set of
people in a different speaking order counts
as a different sequence.
Count the number of possible presenting sequences. Since the answer can be large, output it
modulo .
Input
A single line containing two integers and
.
Output
Print one integer: the number of presenting sequences of length , modulo
.
Constraints
Example 1
Input
5 2
Output
20
Explanation
There are choices for slot
and then
remaining choices for slot
, so there are
ordered sequences. Alice then Bob is different from Bob then Alice.
Example 2
Input
4 0
Output
1
Explanation
There is exactly one empty presenting sequence.
Example 3
Input
3 5
Output
0
Explanation
You cannot fill slots using only
people.
Comments