import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static long MOD = 1000000007; public static long fact(long N){ long ret = 1; for(long i = 1; i <= N; i++){ ret *= i; ret %= MOD; } return ret; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int k = sc.nextInt(); // k = 0 の時は N bit なので N! 個の立て方がある if(k == 0){ System.out.println(fact(N)); return; } // long[] as = new long[k]; for(int i = 0; i < k; i++){ as[i] = sc.nextLong(); } Arrays.sort(as); for(int i = 1; i < k; i++){ if((as[i] & as[i - 1]) != as[i - 1]){ //System.out.println(0); return; } } long answer = fact(Long.bitCount(as[0])); for(int i = 1; i < k; i++){ final long xor = as[i] ^ as[i - 1]; answer *= fact(Long.bitCount(xor)); answer %= MOD; } System.out.println(answer); } }