#include "bits/stdc++.h" using namespace std; #define DEBUG(x) cout<<#x<<": "< #define vl vector #define vii vector< vector > #define vll vector< vector > #define vs vector #define pii pair #define pis pair #define psi pair const int inf = 1000000001; const ll INF = 1e16; #define MOD 1000000007 #define mod 1000000009 #define pi 3.14159265358979323846 #define Sp(p) cout<> n >> m; if (n < m) { cout << 0 << endl; return 0; } fact[0] = 1; for (i = 1; i <= m; i++) { fact[i] = (fact[i - 1] * i) % MOD; } for (i = 0; i <= m; i++) { if (i == 0) C[i] = 1; else C[i] = nCr(m, i); } ll ans = 0; int fugou = 1; for (i = 0; i < m; i++) { ans += (fugou*C[i] * mod_pow(m - i, n, MOD)) % MOD; fugou *= (-1); } cout << ((ans < 0) ? (ans + MOD) : ans) << endl; }