from functools import lru_cache @lru_cache(maxsize=None) def power(n): if n <= 1: return 1 else: return power(n-1)*n n, k = map(int, input().split()) if k == 0: print(power(n)); exit() a_list = list(map(int, input().split())) list_of_list = list() for m in a_list: tmp = list(map(int, bin(m)[2:])) tmp += [0]*(n-len(tmp)) list_of_list.append(tmp) list_of_list = sorted(list_of_list, key=lambda x: x.count(1)) list_of_list.append([1]*n) num_power = 1 source = [0]*n for _list in list_of_list: count = 0 for i, j in zip(source, _list): if j-i < 0: print(0); exit() elif j-i == 1: count += 1 source = _list num_power *= power(count) print(num_power%(10**9+7))