#include <bits/stdc++.h>
using namespace std;
inline void read(long long &x) {
  char ch = getchar();
  x = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
}
const long long N = 5038, mod = 1e9 + 7;
long long f[N][N];
signed main() {
  long long n, m;
  read(n), read(m);
  for (long long i = 1; i <= n; ++i) f[0][i] = 1;
  for (long long i = 1; i <= n; ++i) {
    long long sum = 0;
    for (long long j = 1; j <= m; ++j) {
      f[i][j] = (sum + (j + 1) * f[i - 1][j]) % mod;
      sum = (sum * 2 + j * (f[i - 1][j])) % mod;
    }
  }
  return printf("%lld\n", f[n][m]), 0;
}
