#include <bits/stdc++.h> #define LL long long using namespace std; const int mod=1e9+7; LL f[305][305]; int main(){ int n, m; scanf("%d%d", &n, &m); f[0][0]=1; for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ f[i][j]=f[i-1][j]+f[i-1][j-1]*(m-j+1)%mod; f[i][j]%=mod; } } LL ans=0; for(int i=1; i<=n; i++){ ans=(ans+f[n][i])%mod; } printf("%lld\n", ans); return 0; }