#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 5e3+10, mod = 1e9+7, inv2 = (mod+1)>>1;
int n,m,f[N][N],inv[N],pw[N];

int main(){
	n=read(),m=read();
	pw[0]=inv[0]=1;
	For(i,1,max(n,m)) pw[i]=2ll*pw[i-1]%mod,inv[i]=1ll*inv[i-1]*inv2%mod;
	f[1][0]=1;
	For(i,1,m) f[1][i]=pw[i];
	For(i,2,n){
		f[i][1]=pw[i];
		int s=0;
		For(j,2,m){
			s=(s+1ll*f[i-1][j-1]*(j-1)%mod*inv[j-1])%mod;
			f[i][j]=(1ll*f[i-1][j]*(j+1)+1ll*s*f[1][j-1])%mod;
		}
	}
	printf("%d\n",f[n][m]);
}