#include<bits/stdc++.h>
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
using namespace std;
const int N=5005;
const int mo=1000000007;
int n,m;
int f[N][N];
int g[N][N];
int main(){
	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]=(2*g[i-1][j-1]+1ll*f[i-1][j]*j)%mo;
		f[i][j]=(1ll*f[i-1][j]*(j+1)+g[i-1][j-1])%mo; 
	}
	printf("%d\n",f[n][m]);
}