using System; using System.Linq; namespace No462_1{ public class Program{ public static void Main(string[] args){ var sr = new StreamReader(); //--------------------------------- var N = sr.Next(); var K = sr.Next(); var A = sr.Next(K); const int mod = 1000000007; var mf = Ex.ModFac(100, mod); var a = A .Concat(new[]{0, (long)Math.Pow(2, N) - 1}) .Select(x => Convert.ToString(x, 2).PadLeft(N, '0')) .OrderBy(x => x.Count(c => c == '1')).ToArray(); var res = 1L; for(var i = 1; i < K + 2; i++){ for(var j = 0; j < N; j++) if(a[i - 1][j] == '1' && a[i][j] == '0') res = 0L; res *= mf[a[i].Count(c => c == '1') - a[i - 1].Count(c => c == '1')]; res %= mod; } Console.WriteLine(res); //--------------------------------- } } public class Ex{ public static long[] ModFac(int n, int mod){ var ret = new long[n]; ret[0] = 1; for(var i = 1; i < n; i++) ret[i] = ret[i - 1] * i % mod; return ret; } } public class StreamReader{ private readonly char[] _c = {' '}; private int _index = -1; private string[] _input = new string[0]; private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput()); public T Next(){ if(_index == _input.Length - 1){ _index = -1; while(true){ string rl = _sr.ReadLine(); if(rl == null){ if(typeof(T).IsClass) return default(T); return (T)typeof(T).GetField("MinValue").GetValue(null); } if(rl != ""){ _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries); break; } } } return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture); } public T[] Next(int x){ var ret = new T[x]; for(var i = 0; i < x; ++i) ret[i] = Next(); return ret; } public T[][] Next(int y, int x){ var ret = new T[y][]; for(var i = 0; i < y; ++i) ret[i] = Next(x); return ret; } } }