#include <bits/stdc++.h>
using namespace std;
int64_t modularExponentiation(int64_t x, int64_t n, int64_t M) {
  int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
int main() {
  int64_t n, m, i, res, fres, M = 1000000007;
  cin >> n >> m;
  res = modularExponentiation(2, m, M);
  res = res - 1;
  fres = modularExponentiation(res, n, M);
  cout << fres << endl;
  return 0;
}
