#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, m, ans;
int bp(int a, int b) {
  int ret = 1;
  while (b > 0) {
    if (b & 1) ret = (ret * 1ll * a) % mod;
    b >>= 1;
    a = (a * 1ll * a) % mod;
  }
  return ret;
}
int main() {
  cin >> n >> m;
  ans = bp((bp(2, m) - 1 + mod) % mod, n);
  cout << ans << endl;
}
