#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7,iv=(mod+1)/2;
int n,m,dp[5555][5555],sum[5555][5555];
int pw[5555],ipw[5555];
int main()
{
	scanf("%d%d",&n,&m);
	pw[0]=ipw[0]=1;
	for (int i=1;i<=5005;i++) 
	{
		pw[i]=(pw[i-1]+pw[i-1])%mod;
		ipw[i]=1ll*iv*ipw[i-1]%mod;
	}
	for (int i=1;i<=m;i++) dp[0][i]=1;
	for (int i=1;i<=m;i++) sum[0][i]=(1ll*dp[0][i]*i%mod*ipw[i]+sum[0][i-1])%mod;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
		{
			dp[i][j]=(1ll*sum[i-1][j-1]*pw[j-1]%mod+1ll*dp[i-1][j]*(j+1))%mod;
		}
		for (int j=1;j<=m;j++)
		{
			sum[i][j]=(1ll*dp[i][j]*j%mod*ipw[j]+sum[i][j-1])%mod;
		}
	}
	printf("%d\n",dp[n][m]);
	return 0;
}