Given **N** distinct integers from 1 to **N**, you have to find the number of ways the **N** integers can be rearranged in **M** empty slots such that, no integer matches with its slot index. Note that, slots are indexed from 1 to **M**.

Print the number of ways modulo **23377788**.

0<=n<=m<100000

I came up with a solution like this but not sure its correct or not. And have not any idea to modulu it by non prime.