import java.io.*; import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); long current = 0; int k = sc.nextInt(); long ans = 1; for (int i = 0; i < k; i++) { long x = sc.nextLong(); if ((current | x) == x) { ans *= kaijo(pop(x) - pop(current)); ans %= MOD; } else { ans = 0; } current = x; } long last = (1L << n) - 1; if ((current | last) == last) { ans *= kaijo(pop(last) - pop(current)); ans %= MOD; } else { ans = 0; } System.out.println(ans); } static long kaijo(int x) { if (x == 0) { return 1; } else { return x * kaijo(x - 1) % MOD; } } static int pop(long x) { int count = 0; while (x > 0) { if (x % 2 == 1) { count++; } x /= 2; } return count; } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }