//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")


using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 5000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

int DP[N][N], PS[N][N], n, m, t2[N], inv[N];

int add(int a, int b){
	a += b;
	if (a >= MOD) a -= MOD;
	return a;
}

int mul(int a, int b){
	return a * 1ll * b % MOD;
}

int minu(int a, int b){
	a -= b;
	if (a < 0) a += MOD;
	return a;
}

int POW(int a, int b){
	int res = 1;
	while (b){
		if (b & 1) res = mul(res, a);
		b >>= 1;
		a = mul(a, a);
	}
	return res;
}

void cPS(int i){
	int Now = 0;
	for (int j = N - 1; j >= 0; j--){
		PS[i][j] = mul(j, mul(tav[Now++], DP[i][j]));
	}
	for (int j = 1; j <= n; j++) PS[i][j] = add(PS[i][j], PS[i][j - 1]);
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	tav[0] = 1;
	for (int i = 1; i < N; i++){
		tav[i] = mul(tav[i - 1], 2);
	}
	inv[N - 1] = POW(tav[N - 1], MOD - 2);
	for (int i = N - 2; i >= 0; i--){
		inv[i] = mul(inv[i + 1], 2);
	}	
	for (int i = 1; i <= m; i++) DP[1][i] = tav[i];
	cPS(1);
	for (int i = 2; i <= n; i++) for (int j = 1; j <= m; j++){
		DP[i][j] = mul(2, DP[i - 1][j]);
		
	}

	return 0;
}
