import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); sc.close(); int mod = 1000000007; long val1 = nCr(n, n - m, mod); long val2 = 1; for (int i = 1; i <= m; i++) { val2 = val2 * i % mod; } System.out.println(val1 * val2 % mod); } static long nCr(int n, int r, int m) { long val = 1; for (int i = 1; i <= r; i++) { val = val * (n - i + 1) % m; val = val * modinv(i, m) % m; } return val; } static long modinv(long a, int m) { long b = m; long u = 1; long v = 0; long tmp = 0; while (b > 0) { long t = a / b; a -= t * b; tmp = a; a = b; b = tmp; u -= t * v; tmp = u; u = v; v = tmp; } u %= m; if (u < 0) u += m; return u; } }