#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
const int mod = 1e9 + 7;

ll mpow(ll x, ll n) {
  ll res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n /= 2;
  }
  return res;
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n, m;
  cin >> n >> m;
  vl d(m + 1);
  d[m] = 1;
  for (int t = 0; t < n; ++t) {
    vl nd(d.size());
    ll s = 0;
    for (int i = m; i > 0; --i) {
      nd[i] = (i * s + d[i] * (i + 1)) % mod;
      s = (2 * s + d[i]) % mod;
    }
    d.swap(nd);
  }
  ll res = 0;
  for (int i = 0; i < d.size(); ++i) res = (res + d[i]) % mod;
  cout << res << endl;
  return 0;
}
