MOD = 10 ** 9 + 7 n, k = map(int, input().split()) if k != 0: A = list(map(int, input().split())) else: A = [] A.append((1 << n) - 1) A.append(0) A.sort() k += 1 for i in range(1, k): if A[i] & A[i - 1] != A[i - 1]: print(0) exit() fact = [1] for i in range(1, n + 1): fact.append(fact[-1] * i % MOD) ans = 1 for i in range(k): x = A[i] ^ A[i + 1] ans *= fact[bin(x).count("1")] ans %= MOD print(ans)