#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
long long mypos(long long n, long long m) {
  if (m == 1) return n;
  if (m == 0) return 0;
  long long a = mypos(n, m / 2);
  if (!(m % 2)) {
    return (a % MOD * a % MOD) % MOD;
  } else {
    return (n % MOD * (a % MOD * a % MOD) % MOD) % MOD;
  }
}
signed main() {
  long long n, m;
  cin >> n >> m;
  long long g = mypos((mypos(2, m) - 1), n) % MOD;
  cout << g << endl;
}
