#include using namespace std; typedef long long ll; typedef long double ld; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b= mod) x -= mod; return *this; } constexpr mint& operator-=(const mint& a){ if((x += mod-a.x) >= mod) x -= mod; return *this; } constexpr mint& operator*=(const mint& a){ (x *= a.x) %= mod; return *this; } constexpr mint operator+(const mint& a) const{ mint res(*this); return res+=a; } constexpr mint operator-(const mint& a) const{ mint res(*this); return res-=a; } constexpr mint operator*(const mint& a) const{ mint res(*this); return res*=a; } constexpr mint pow(long long x) const{ if(!x) return 1; mint a = pow(x>>1); a *= a; if(x&1) a *= *this; return a; } constexpr mint inv() const{ return pow(mod-2); } constexpr mint& operator/=(const mint& a){ return (*this) *= a.inv(); } constexpr mint operator/(const mint& a) const{ mint res(*this); return res/=a; } friend ostream& operator<<(ostream& os, const mint& m){ os << m.x; return os; } }; ll fac[nmax],finv[nmax],inv[nmax]; void COMinit(){ fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i> n >> m; COMinit(); mint ans=0; for(int i=m;i>=1;i--){ mint c=i; if((m-i)%2==0){ ans+=c.pow(n)*com(m,i); } else{ ans-=c.pow(n)*com(m,i); } } cout << ans << endl; }