func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 200;   const int oo = 1000000007;   int n, k, m, a[10], lik[10], head[10], adj[10];   long long res;   bool fre[10], ok;   void make(int u, int v) {     m++;     adj[m] = v;     lik[m] = head[u];     head[u] = m;   }   void dfs(int u) {     fre[u] = false;     int i = head[u];     while (i != 0) {       int v = adj[i];       if (fre[v]) dfs(v);       i = lik[i];     }   }   bool check() {     m = 0;     memset(lik, 0, sizeof(lik));     memset(head, 0, sizeof(head));     memset(fre, 1, sizeof(fre));     for (long long i = 1; i <= k; i++) make(a[i], i);     dfs(1);     for (long long i = 1; i <= k; i++)       if (fre[i]) return false;     return true;   }   void att(int i) {     if (i > k) {       if (!ok) return;       if (check()) res++;       return;     }     for (long long x = 1; x <= k; x++)       if ((x != i) || (i == 1)) {         bool z = ok;         if (x == 1) ok = true;         a[i] = x;         att(i + 1);         ok = z;       };   }   int main() {     cin >> n >> k;     long long sum = 1;     for (long long i = 1; i <= n - k; i++) sum = (sum * (n - k)) % oo;     att(1);     cout << (res * sum) % oo;   }   