#include <bits/stdc++.h>
using namespace std;
long long const INF = 2e18 + 100;
int const MAX = 3 * 1e5 + 10;
long long mod_and_pow(long long a, long long b, long long d) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % d;
    a = (a * a) % d;
    b >>= 1;
  }
  return ans;
}
long long l = (1LL << 62);
unsigned long long m = (1LL << 63);
vector<pair<int, int> > v;
multiset<int> mset;
multiset<int, greater<int> > ms;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, a, d = 1e9 + 7;
  cin >> n >> m;
  a = mod_and_pow(2, m, d) - 1;
  cout << mod_and_pow(a, n, d) << '\n';
  return 0;
}
