#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, m;
  long long num = 1;
  cin >> n >> m;
  long long a = 2;
  while (m > 0) {
    if (m % 2 == 0) {
      a *= a;
      a %= 1000000007;
      m /= 2;
    } else {
      num *= a;
      num %= 1000000007;
      ;
      m--;
    }
  }
  num--;
  if (num < 0) num += 1000000007;
  long long ans = 1;
  while (n > 0) {
    if (n % 2 == 0) {
      num *= num;
      num %= 1000000007;
      n /= 2;
    } else {
      ans *= num;
      ans %= 1000000007;
      ;
      n--;
    }
  }
  cout << ans << "\n";
  return 0;
}
