#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
const int N=5005,M=1000000007;
int n,i,m,j,k;
long long f[N][N],a[N],ans;
int main()
{
	scanf("%d %d",&n,&m);
	a[0]=1;
	for(i=1;i<=max(n,m);++i)
		a[i]=a[i-1]*2%M;
	f[n][m]=1;
	for(i=n-1;i>=0;--i)
	{
		for(j=m;j>=1;--j)
			f[i][j]=(f[i+1][j+1]+f[i][j+1]*2)%M;
		for(j=1;j<=m;++j)
			f[i][j]=(f[i][j]*j+f[i+1][j]*(j+1))%M;
		/*{
			f[i][j]=f[i+1][j]*(j+1)%M;
			for(k=j+1;k<=m;++k)
				f[i][j]=(f[i][j]+f[i+1][k]*a[k-j-1]%M*j)%M;
		}*/
	}
	for(i=1;i<=m;++i)
		ans=(ans+f[0][i])%M;
	cout<<(ans%M+M)%M;
}
