#include <bits/stdc++.h>
using namespace std;
void dpm(map<long long int, long long int> m1) {
  for (auto it = m1.begin(); it != m1.end(); it++) {
    cout << it->first << " " << it->second << '\n';
  }
  cout << '\n';
}
void dpv(vector<long long int> v) {
  for (long long int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << '\n';
}
void dps(set<long long int> s1) {
  for (auto it = s1.begin(); it != s1.end(); it++) cout << *it << " ";
  cout << '\n';
}
void dpa(long long int arr[], long long int n) {
  for (long long int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << '\n';
}
long long calc(long long base, long long power) {
  long long result = 1;
  long long int MOD = 1000000007;
  while (power > 0) {
    if (power % 2 == 1) {
      result = (result * base) % MOD;
    }
    base = (base * base) % MOD;
    power = power / 2;
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int i, j;
  long long int t = 1;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    long long int b = 1000000007;
    long long int temp = calc(2, m) - 1;
    temp = calc(temp, n);
    cout << temp;
  }
}
