#include <bits/stdc++.h>
using namespace std;
long long qpow(long long m, long long n) {
  long long mah = 1e9 + 7;
  long long h = m;
  long long ans = 1;
  while (n) {
    long long x = n % 2;
    if (x == 1) ans = (h * ans) % mah;
    h = (h * h) % mah;
    n /= 2;
  }
  return ans;
}
int main() {
  long long m, n;
  long long mah = 1e9 + 7;
  while (~scanf("%lld%lld", &m, &n)) {
    long long c = 0;
    c = qpow(2, n);
    c = (c - 1) % mah;
    long long d = 0;
    d = qpow(c, m);
    d = d % mah;
    printf("%lld\n", d);
  }
  return 0;
}
