#include <bits/stdc++.h>
using namespace std;
long long np, mp, ans = 1, md = 1e9 + 7;
long long pw(long long n, long long m) {
  if (m == 0) return 1;
  long long ret = pw(n, m / 2);
  ret = ret * ret % md;
  if (m % 2 == 1) ret = ret * n % md;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0), cout.precision(15);
  cin >> np >> mp;
  ans = pw(2ll, mp) - 1;
  if (ans < 0) ans += md;
  cout << pw(ans, np);
  return 0;
}
