import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) def cmb(n, r, mod): if ( r<0 or r>n ): return 0 return (g1[n] * g2[r] % mod) * g2[n-r] % mod mod = 10**9 + 7 N = 10**6 g1 = [1]*(N+1) g2 = [1]*(N+1) inverse = [1]*(N+1) for i in range( 2, N + 1 ): g1[i]=( ( g1[i-1] * i ) % mod ) inverse[i]=( ( -inverse[mod % i] * (mod//i) ) % mod ) g2[i]=( (g2[i-1] * inverse[i]) % mod ) inverse[0]=0 H,W = mi() res = 0 for i in range(H+1): c = pow(2,H-i,mod) if i&1: res -= cmb(H,i,mod) * pow(c-1,W,mod) % mod else: res += cmb(H,i,mod) * pow(c-1,W,mod) % mod res %= mod print(res)