#include <bits/stdc++.h>
using namespace std;
int expo(long long x, long long n, long long M) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return expo((x * x) % 1000000007, n / 2, M);
  else
    return (x * expo((x * x) % M, (n - 1) / 2, M)) % M;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, x = 0, y = 0, i, j;
  long long n, m;
  cin >> n >> m;
  long long ans = expo(2, m, 1000000007) - 1;
  ans = expo(ans, n, 1000000007);
  cout << ans;
  return 0;
}
