#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = LLONG_MAX / 2;
const long long N = 2e5 + 1;
long long power(long long first, long long second, long long p) {
  long long ans = 1;
  first = first % p;
  while (second) {
    if (second & 1) ans = (ans * first) % p;
    second = second >> 1;
    first = (first * first) % p;
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  {
    long long n, m;
    cin >> n >> m;
    cout << power(power(2, m, M) - 1, n, M);
  }
  return 0;
}
