using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, k) = (c[0], c[1]); var a = new List(); if (k > 0) a = NList.ToList(); a.Sort(); if (a.Count == 0 || a[0] != 0) a.Insert(0, 0); var last = (1L << (int)n) - 1; if (a[^1] != last) a.Add(last); var mod = 1_000_000_007; var ans = 1L; for (var i = 1; i < a.Count; ++i) { if ((a[i] | a[i - 1]) != a[i]) { WriteLine(0); return; } var d = Popcount(a[i]) - Popcount(a[i - 1]); for (var j = 2; j <= d; ++j) ans = ans * j % mod; } WriteLine(ans); } static int Popcount(long n) { var c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555); c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333); c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f); c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff); c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff); c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff); return (int)c; } }