package yukicoder; import java.util.*; public class Q462 { final static long MODULO = 1_000_000_000 + 7; public static void main(String[] args) { long[] fac = new long[100]; long[] invfac = new long[100]; fac[0] = 1; for (int i = 1; i < 100; ++i) { fac[i] = fac[i - 1] * i % MODULO; } invfac[invfac.length - 1] = pow(fac[fac.length - 1], MODULO - 2); for (int i = invfac.length - 2; i >= 0; --i) { invfac[i] = invfac[i + 1] * (i + 1) % MODULO; } long[][] dp = new long[100][]; // dp[i][j]:i個からj個数を作る方法 for (int i = 0; i < 100; ++i) { dp[i] = new long[i + 1]; dp[i][0] = 1; for (int j = 1; j <= i; ++j) { dp[i][j] = dp[i - 1][j - 1] * j % MODULO; if (j <= i - 1) dp[i][j] += dp[i - 1][j] * j % MODULO; dp[i][j] %= MODULO; } } Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); if (k == 0) { System.out.println(fac[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) { dp1[j] += dp1[j - l] * dp[(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)); } static long pow(long a, long n) { long ret = 1; for (; n > 0; n >>= 1, a = (a * a) % MODULO) { if (n % 2 == 1) ret = (ret * a) % MODULO; } return ret; } }