package yukicoder; import java.util.*; public class Q462 { final static long MODULO = 1_000_000_000 + 7; public static void main(String[] args) { long[][] dp = new long[100][100]; dp[0][0] = 1; for (int i = 1; i < 100; ++i) { for (int j = 0; j <= i; ++j) { if (j > 0) dp[i][j] = dp[i - 1][j - 1] * j % MODULO; if (j <= i - 1) dp[i][j] += dp[i - 1][j] * (j + 1) % MODULO; dp[i][j] %= MODULO; } } long[][] dp3 = new long[100][100]; dp3[1][0] = 1; for (int i = 2; i < 100; ++i) { for (int j = 0; j <= i; ++j) { if (j > 0) dp3[i][j] = dp3[i - 1][j - 1] * j % MODULO; if (j <= i - 1) { dp3[i][j] += (dp3[i - 1][j] * j + dp[i - 1][j]) % MODULO; } dp3[i][j] %= MODULO; } } dp3[0][0] = 1; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); if (k == 0) { System.out.println(dp[n][n] % MODULO); return; } long[] a = new long[k]; long[] diff = new long[k + 1]; for (int i = 0; i < k; ++i) { a[i] = sc.nextLong(); } for (int i = 0; i + 1 < k; ++i) { diff[i + 1] = count(a[i], a[i + 1]); if (diff[i + 1] < 0) { System.out.println(0); return; } } diff[0] = count(0, a[0]); diff[k] = count(a[k - 1], (1L << n) - 1); long[] dp1 = new long[n + 1]; dp1[0] = 1; if (a[0] != 0) dp1[1] = 1; for (int i = 0; i < k + 1; ++i) { for (int j = n; j >= 1; --j) { boolean f = false; if ((a[k - 1] != (1L << n) - 1 && i == k)) f = true; for (int l = 1; l <= diff[i] + (f ? 0 : -1) && j - l >= 0; ++l) { if (f && l == diff[i]) { dp1[j] += dp1[j - l] * dp[(int) diff[i]][l] % MODULO; } else dp1[j] += dp1[j - l] * dp3[(int) diff[i]][l] % MODULO; dp1[j] %= MODULO; } } } System.out.println(dp1[n + 1 - k]); } static long count(long min, long max) { for (int i = 0; i < 60; ++i) { if ((min & (1L << i)) > 0 && (max & (1L << i)) == 0) { return -1; } } int diff = Long.bitCount(max) - Long.bitCount(min); return diff; } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }