#include <iostream>
#include <cstdio>
#define MN 5010
#define mod 1000000007

int f[MN][MN], mi[MN];

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	mi[0] = 1; for(int i = 1; i <= m; i++) mi[i] = mi[i - 1] * 2 % mod;
	for(int j = 1; j <= m; j++) f[0][j] = 1;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= m; j++)
			f[i][j] = (f[i][j - 1] * 2 + 1ll * f[i - 1][j - 1] * (j - 1)) % mod;
		for(int j = 1; j <= m; j++)
			f[i][j] = (f[i][j] + 1ll * f[i - 1][j] * (j + 1)) % mod;
	}
		
	printf("%d\n", f[n][m]);
}