# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

const int N = 5010, P = 1e9 + 7;
int mul[N], f[N][N], n, m;
int main(){
	read(n); read(m);
	for (int i = 0; i <= m; i++) f[0][i] = 1;
	for (int i = 1; i <= n; i++){
		int tot = 0;
		for (int j = 1; j <= m; j++){
			f[i][j] = (j + 1ll) * f[i - 1][j] % P;
			tot = (tot * 2ll + f[i - 1][j - 1] * (j - 1ll)) % P;
			f[i][j] = (f[i][j] + tot) % P;
		}
	}
	printf("%d\n", f[n][m]);
	return 0;
}

