#include #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) typedef long long ll; using namespace std; const ll mod=1000000007, INF=mod*mod*3LL; #define doublecout(a) cout< 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); cominit(); ll n, m; cin >> n >> m; ll ans = 0; for(ll i=0;i<=m;i++){ ans += (com(m, i) * modpow(i, n) * (((m-i)&1? -1: 1)))%mod; ans %= mod; } cout << ans << endl; return 0; }