#include <bits/stdc++.h>
using namespace std;
const int64_t M = 1e9 + 7;
int64_t p(int64_t base, int64_t deg) {
  if (deg == 0) return 1;
  if (deg == 1) return base % M;
  int64_t res = p(base, deg / 2);
  res = (res * res) % M;
  if (deg & 1) res = (res * base) % M;
  return res;
}
int main() {
  int64_t n, m;
  cin >> n >> m;
  cout << p(p(2, m) + M - 1, n) << endl;
}
