#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
const long long inf = 1e18;
const long double eps = 1e-9;
long long pow1(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a;
      res = res % 1000000007;
    }
    a = a * a;
    a = a % 1000000007;
    b >>= 1;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long x = pow1(2, m);
  x = (x - 1 + 1000000007) % 1000000007;
  x = pow1(x, n);
  cout << x;
  return 0;
}
