#include<bits/stdc++.h>
using namespace std;

const int P = 1e9 + 7; int dp[5003][5003] , N , M , pw[5003] , iv[5003];

int main(){
	cin >> N >> M; for(int j = 1 ; j <= M ; ++j) dp[0][j] = 1;
	pw[0] = iv[0] = 1; pw[1] = 2; iv[1] = (P + 1) / 2;
	for(int i = 2 ; i <= M ; ++i){pw[i] = (pw[i - 1] * 2) % P; iv[i] = 1ll * iv[i - 1] * iv[1] % P;}
	
	for(int i = 1 ; i <= N ; ++i){
		int sum = 0;
		for(int j = 1 ; j <= M ; ++j){
			dp[i][j] = (dp[i][j] + 1ll * sum * pw[j] + (j + 1ll) * dp[i - 1][j]) % P;
			sum = (sum + 1ll * dp[i - 1][j] * j % P * iv[j + 1]) % P;
		}
	}
	cout << dp[N][M]; return 0;
}