import math n,k = list(map(int,input().split())) na = [] ns = 0 nd = 1 df = False if k > 0: a = list(map(int,input().split())) a.append(0) a.sort() for i in range(k): if (a[i])&(~a[i+1]) > 0: df = True break else: d = bin(a[i]^a[i+1]).count("1") na.append(d) ns += d nd *= math.factorial(d) if df: print(0) elif ns > n: print(0) else: nd *= math.factorial(n-ns) print(nd)