#include <bits/stdc++.h>
using namespace std;
long long int hell = 1e9 + 7;
bool prime(long long int n) {
  for (long long int i = 1; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long power(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
int main() {
  int t = 1;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    long long int ans = 1;
    ans = power(2, m, hell) % hell;
    ans = (ans - 1 + hell) % hell;
    long long ans1 = power(ans, n, hell) % hell;
    cout << ans1;
  }
  return 0;
}
