#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 2e5 + 5;
double dot(complex<double> a, complex<double> b) {
  return (conj(a) * b).real();
}
double cross(complex<double> a, complex<double> b) {
  return (conj(a) * b).imag();
}
double angle(complex<double> a, complex<double> b) {
  double dt = dot(a, b);
  dt /= abs(a);
  dt /= abs(b);
  return acos(dt) * 180.0 / acos(-1);
}
long long d, x, y;
void extendedEuclid(long long A, long long B) {
  if (B == 0) {
    d = A;
    x = 1;
    y = 0;
  } else {
    extendedEuclid(B, A % B);
    int temp = x;
    x = y;
    y = temp - (A / B) * y;
  }
}
long long modInverse(long long A, long long M) {
  extendedEuclid(A, M);
  return (x % M + M) % M;
}
long long fact[1000006], inv[1000006];
long long fp(long long base, long long exp) {
  if (exp == 0) return 1;
  long long ans = fp(base, exp / 2);
  ans = (ans * ans) % mod;
  if (exp % 2 != 0) ans = (ans * (base % mod)) % mod;
  return ans;
}
void calcFacAndInv(long long n) {
  fact[0] = inv[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fact[i] = (i * fact[i - 1]) % mod;
    inv[i] = fp(fact[i], mod - 2);
  }
}
long long ncr(long long n, long long r) {
  return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}
long long npr(long long n, long long r) { return (fact[n] * inv[n - r]) % mod; }
int main() {
  long long n, m;
  calcFacAndInv(1000000);
  cin >> n >> m;
  long long ans = fp((fp(2, m) - 1) % mod, n) % mod;
  cout << ans;
  return 0;
}
