n,k = map(int,input().split()) if k: *a, = map(int,input().split()) else: a = [] a.sort() a.append(2**n-1) v = 0 ans = 1 MOD = 10**9+7 for ai in a: if ai&v != v: ans = 0 c = bin(ai^v).count("1") for i in range(1,c+1): ans *= i ans %= MOD v = ai print(ans)