#include <bits/stdc++.h>
using namespace std;
int const N = 1e6 + 100;
long long int const LINF = numeric_limits<long long int>::max();
int const INF = numeric_limits<int>::max();
int const BN = 31;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int pow_mod(long long int a, long long int e, long long int m) {
  long long int res = 1;
  while (e) {
    if (e & 1) res = res * a % m;
    a = a * a % m;
    e >>= 1;
  }
  return res;
}
long long int inv_mod(long long int b, long long int m) {
  b %= m;
  long long int x = 0, y = 1, r, q, a = m;
  while (b) {
    q = a / b;
    r = a % b;
    a = b;
    b = r;
    r = x;
    x = y;
    y = r - q * y;
  }
  x += m;
  return x % m;
}
vector<int> fact(10, 1);
vector<vector<long long int> > dp(10, vector<long long int>(10, -1));
long long int solve(int n, int m) {
  if (dp[n][m] != -1) return dp[n][m];
  if (n == 1)
    dp[n][m] = (1ll << m) - 1;
  else if (m == 1)
    dp[n][m] = 1;
  else {
    long long int ret = (1ll << (n * m));
    for (int i = 1; i <= n; i++) {
      ret -= (fact[n] / (fact[n - i] * fact[i])) * solve(n - i, m);
    }
    dp[n][m] = ret;
  }
  return dp[n][m];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, mod = 1e9 + 7;
  cin >> n >> m;
  long long int p = pow_mod(2, m, mod) + mod - 1;
  p %= mod;
  p = pow_mod(p, n, mod);
  cout << p << endl;
}
