#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long add(long long a, long long b) {
  a %= 1000000007;
  b %= 1000000007;
  return (a + b) % 1000000007;
}
long long sub(long long a, long long b) {
  a %= 1000000007;
  b %= 1000000007;
  return (a - b + 1000000007) % 1000000007;
}
long long prod(long long a, long long b) {
  a %= 1000000007;
  b %= 1000000007;
  return (a * b) % 1000000007;
}
pair<long long, long long> solve(long long a, long long b, long long p,
                                 long long g) {
  if (a % b == 0) return make_pair(0, 1);
  pair<long long, long long> p1 = solve(b, a % b, p, g);
  return {p1.second, p1.first - (p1.second * (a / b))};
}
vector<int> v[1000005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long p = power(2ll, m, 1000000007);
  p = sub(p, 1);
  cout << power(p, n, 1000000007);
  return 0;
}
