#!/usr/bin/python2 # -*- coding: utf-8 -*- # † from math import factorial as fact mod = 10**9 + 7 n, k = map(int, raw_input().split()) if k == 0: res = fact(n) % mod print res exit(0) a = sorted(map(int, raw_input().split())) val = a[0] xor = a[0] for i in xrange(1, k): val |= a[i] xor ^= a[i] if val != a[i]: print 0 exit(0) bit = bin(xor)[2:].zfill(n) cnt = bit.count('0') res = fact(cnt) % mod print res