#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=1000000007;
const int N=5005;
int n,m,P[N],IP[N];
int f[N][N],g[N][N];
int main(){
	P[0]=IP[0]=1;
	For(i,1,N-1) P[i]=2ll*P[i-1]%mo;
	For(i,1,N-1) IP[i]=1ll*IP[i-1]*(mo+1)/2%mo;
	scanf("%d%d",&n,&m);
	For(i,1,m) f[0][i]=1;
	For(i,1,n){
		For(j,1,m) g[i-1][j]=(g[i-1][j-1]+1ll*f[i-1][j]*j%mo*IP[j])%mo;
		For(j,1,m) f[i][j]=(1ll*f[i-1][j]*(j+1)%mo+1ll*g[i-1][j-1]*P[j-1])%mo; 
	}
	//cout<<f[1][2]<<' '<<f[2][2]<<' '<<f[3][2]<<endl;
	printf("%d\n",f[n][m]);
}
/*
21? 12
2?1
?21

*/