#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long dp[5005][5005];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	dp[1][0]=1;
	for (int i=1;i<=m;i++)
	dp[1][i]=(2*dp[1][i-1])%mod;
	for (int i=2;i<=n;i++)
	{
		for (int j=2;j<=m;j++)
		dp[i][j]=(2*dp[i][j-1]+dp[i-1][j-1]*(j-1))%mod;
		for (int j=1;j<=m;j++)
		dp[i][j]=(dp[i][j]+(j+1)*dp[i-1][j])%mod;
	}
	printf("%lld",dp[n][m]);
}