func_code_string: #include <bits/stdc++.h>   using namespace std;   bool debug = false;   int n, m, k;   int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};   long long ln, lk, lm;   int a[10];   bool v[9], vv[9];   bool walk(int x) {     v[x] = 1;     if (a[x] == 1 || vv[a[x]]) return vv[x] = 1;     if (v[a[x]]) return 0;     return vv[x] = walk(a[x]);   }   bool ck() {     for (int i = 2; i <= k; i++) {       v[i] = 0;       vv[i] = 0;     }     for (int i = 2; i <= k; i++)       if (!v[i]) {         if (!walk(i)) {           return 0;         }       }     return 1;   }   long long tmp;   void dfs(int x) {     if (x == k + 1) {       if (ck()) tmp++;       return;     }     for (int(i) = 1; (i) <= (int)(k); (i)++)       if (i != x) {         a[x] = i;         dfs(x + 1);       }   }   int main() {     scanf( %d%d , &n, &k);     long long ans = k;     dfs(2);     (ans *= tmp) %= 1000000007;     m = n - k;     for (int i = k + 1; i <= n; i++) {       (ans *= m) %= 1000000007;     }     printf( %lld n , ans);     return 0;   }   