n, k = map(int, input().split()) if k > 0: A = list(map(int, input().split())) A.sort() mod = 10**9 + 7 Fact = [1] for i in range(1, n + 1): Fact.append(Fact[-1] * i) ans = 1 L = [0 for _ in range(n)] for i in range(k): NL = [0 for _ in range(n)] a = A[i] cnt = 0 for j in range(n): NL[j] = a % 2 a //= 2 if L[j] == 0 and NL[j] == 1: cnt += 1 elif L[j] == 1 and NL[j] == 0: cnt = -1 break if cnt == -1: print(0) exit() ans *= Fact[cnt] ans %= mod L = NL NL = [1 for _ in range(n)] cnt = 0 for i in range(n): if L[i] == 0 and NL[i] == 1: cnt += 1 ans *= Fact[cnt] ans %= mod print(ans)