N,M = map(int,input().split()) P = 10 ** 9 + 7 inv = P//2 + 1 ans = pow(2,M+1,P)-1 print(ans*inv%P)