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(); int k = sc.nextInt(); long ans = 1; long[] values = new long[k + 2]; for (int i = 1; i <= k; i++) { values[i] = sc.nextLong(); } values[k + 1] = (1L << n) - 1; Arrays.sort(values); for (int i = 1; i <= k + 1; i++) { if ((values[i - 1] | values[i]) == values[i]) { ans *= kaijo(pop(values[i]) - pop(values[i - 1])); 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(); } }