#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001;
struct mi {
  long long v;
  explicit operator long long() const { return v; }
  mi() { v = 0; }
  mi(long long _v) {
    v = (-MOD < _v && _v < MOD) ? _v : _v % MOD;
    if (v < 0) v += MOD;
  }
  friend bool operator==(const mi& a, const mi& b) { return a.v == b.v; }
  friend bool operator!=(const mi& a, const mi& b) { return !(a == b); }
  friend bool operator<(const mi& a, const mi& b) { return a.v < b.v; }
  mi& operator+=(const mi& m) {
    if ((v += m.v) >= MOD) v -= MOD;
    return *this;
  }
  mi& operator-=(const mi& m) {
    if ((v -= m.v) < 0) v += MOD;
    return *this;
  }
  mi& operator*=(const mi& m) {
    v = v * m.v % MOD;
    return *this;
  }
  mi& operator/=(const mi& m) { return (*this) *= inv(m); }
  friend mi pow(mi a, long long p) {
    mi ans = 1;
    assert(p >= 0);
    for (; p; p /= 2, a *= a)
      if (p & 1) ans *= a;
    return ans;
  }
  friend mi inv(const mi& a) {
    assert(a.v != 0);
    return pow(a, MOD - 2);
  }
  mi operator-() const { return mi(-v); }
  mi& operator++() { return *this += 1; }
  mi& operator--() { return *this -= 1; }
  friend mi operator+(mi a, const mi& b) { return a += b; }
  friend mi operator-(mi a, const mi& b) { return a -= b; }
  friend mi operator*(mi a, const mi& b) { return a *= b; }
  friend mi operator/(mi a, const mi& b) { return a /= b; }
  friend ostream& operator<<(ostream& os, const mi& m) {
    os << m.v;
    return os;
  }
  friend istream& operator>>(istream& is, mi& m) {
    long long x;
    is >> x;
    m.v = x;
    return is;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int M, N;
  cin >> M >> N;
  mi cnt[N + 1][N + 1];
  for (int i = 0; i < (N + 1); i++) {
    for (int j = 0; j < (N + 1); j++) {
      cnt[i][j] = 0;
    }
    cnt[i][i] = i + 1;
    for (int j = 1; j < (i); j++) {
      mi lenVar = i - j - 1;
      mi curCnt = i - j + 1;
      cnt[i][j] = curCnt * pow((mi)2, (long long)lenVar);
    }
  }
  mi dp[M + 1][N + 1];
  for (int i = 0; i < (M + 1); i++)
    for (int j = 0; j < (N + 1); j++) dp[i][j] = 0;
  dp[M][N] = 1;
  for (int i = (M + 1) - 1; i >= 1; i--) {
    mi cur = 0;
    mi sum = 0;
    for (int j = (N + 1) - 1; j >= 1; j--) {
      cur -= sum;
      cur *= 2;
      sum *= 2;
      if (j < N) {
        cur -= (j + 2) * dp[i][j + 1];
        sum -= dp[i][j + 1];
      }
      cur += (j + 1) * dp[i][j];
      sum += dp[i][j];
      dp[i - 1][j] = cur;
    }
  }
  mi ans = 0;
  for (int i = 1; i < (N + 1); i++) ans += dp[0][i];
  cout << ans << nl;
  return 0;
}
