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