#include<iostream>

const int MOD = 1e9 + 7;
const int N = 5030;

using namespace std;

long long dp[N][N];

int main()
{
  int n, m;
  cin >> n >> m;
  dp[1][0] = 1;
  for (int j = 1; j <= m; j++)
  {
    dp[1][j] = dp[1][j - 1] * 2 % MOD;
  }
  for (int i = 2; i <= n; i++)
  {
    long long w = 0;
    for (int j = 0; j <= m; j++)
    {
      dp[i][j] = (dp[i - 1][j] * (j + 1) + w) % MOD;
      w = 2 * w % MOD;
      w = (w + dp[i - 1][j] * j) % MOD;
    }
  }
  cout << dp[n][m];
}