#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long solve(long long x, unsigned long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long x = solve(2, m) - 1;
  long long ans = solve(x, n);
  cout << ans << "\n";
  return 0;
}
