Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Polo the Penguin and Houses

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLittle penguin Polo loves his home village. The village has *n* houses, indexed by integers from 1 to *n*. Each house has a plaque containing an integer, the *i*-th house has a plaque containing integer *p*_{i} (1 ≤ *p*_{i} ≤ *n*).

Little penguin Polo loves walking around this village. The walk looks like that. First he stands by a house number *x*. Then he goes to the house whose number is written on the plaque of house *x* (that is, to house *p*_{x}), then he goes to the house whose number is written on the plaque of house *p*_{x} (that is, to house *p*_{px}), and so on.

We know that:

- When the penguin starts walking from any house indexed from 1 to
*k*, inclusive, he can walk to house number 1. - When the penguin starts walking from any house indexed from
*k*+ 1 to*n*, inclusive, he definitely cannot walk to house number 1. - When the penguin starts walking from house number 1, he can get back to house number 1 after some non-zero number of walks from a house to a house.

You need to find the number of ways you may write the numbers on the houses' plaques so as to fulfill the three above described conditions. Print the remainder after dividing this number by 1000000007 (10^{9} + 7).

Input

The single line contains two space-separated integers *n* and *k* (1 ≤ *n* ≤ 1000, 1 ≤ *k* ≤ *min*(8, *n*)) — the number of the houses and the number *k* from the statement.

Output

In a single line print a single integer — the answer to the problem modulo 1000000007 (10^{9} + 7).

Examples

Input

5 2

Output

54

Input

7 4

Output

1728

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/23/2020 05:53:51 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|