#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll p=1e9+7;
ll n,m,i,j,f[5010][5010],g[5010][5010];
int main(){
	scanf("%lld%lld",&n,&m);
	for(i=1;i<=m;i++)f[0][i]=1;
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			g[i-1][j]=(g[i-1][j-1]*2%p+f[i-1][j]*j%p)%p;
			f[i][j]=(g[i-1][j-1]+f[i-1][j]*(j+1))%p;
		}
	}
	printf("%lld",f[n][m]);
}