MOD = 1000000007 H, W = map(int, input().split()) fact = [ None ] * (H + 1) fact[0] = 1 for i in range(H): fact[i + 1] = fact[i] * (i + 1) factinv = [ None ] * (H + 1) factinv[H] = pow(fact[H], MOD - 2, MOD) for i in range(H - 1, -1, -1): factinv[i] = factinv[i + 1] * (i + 1) answer = 0 for i in range(0, H + 1): subanswer = pow(MOD - pow(2, H - i, MOD) + 1, W, MOD) comb = fact[H] * factinv[i] * factinv[H - i] if (i + W) % 2 == 0: answer += comb * subanswer else: answer -= comb * subanswer print(answer % MOD)