#C11595. Book Arrangement Permutations
Book Arrangement Permutations
Book Arrangement Permutations
You are given two integers \(N\) and \(M\), representing the number of books and the number of slots respectively. Marcus wants to arrange \(N\) books into \(M\) available slots. The arrangement is only possible if \(N \ge M\). If \(N < M\), output \(-1\). If \(N \ge M\), the number of arrangements is given by the permutation formula:
\[ P(N, M)=\frac{N!}{(N-M)!} \pmod{1000000007} \]
For the special case when \(N=M\), note that \(P(N, N)=N!\) modulo \(1000000007\).
Your task is to calculate the number of valid arrangements modulo \(10^9+7\) and output the result. Ensure that you read the input from standard input and write the output to standard output.
inputFormat
The input consists of a single line containing two space-separated integers \(N\) and \(M\), where \(N\) is the number of books and \(M\) is the number of slots.
outputFormat
Output a single integer: the number of ways to arrange the books modulo \(1000000007\) if \(N \ge M\), or \(-1\) if \(N < M\).
## sample5 3
60