#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7,N=5005;
int f[N][N];
signed main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;++i)
		f[0][i]=1;
	for(int i=1;i<=n;++i){
		for(int j=2;j<=m;++j)
			f[i][j]=(f[i][j-1]*2ll+f[i-1][j-1]*(j-1)%mod)%mod;
		for(int j=1;j<=m;++j)
			f[i][j]=(f[i][j]+f[i-1][j]*(j+1)%mod)%mod;
	}
	cout<<f[n][m];
	return 0;
}