#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mof = 1e9 + 7;
ll pow_mod(int x, int t) {
  if (t == 0) {
    return 1;
  }
  ll ret = pow_mod(x, t / 2);
  ret = ret * ret % mof;
  if (t % 2) ret *= x;
  return ret % mof;
}
int main() {
  int n, m;
  cin >> n >> m;
  ll bas = pow_mod(2, m);
  bas = (bas + mof - 1) % mof;
  cout << pow_mod(bas, n);
}
