using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ long mod = (long)1e9 + 7; long[] Fact = new long[N+1]; Fact[0] = 1; for(int i=1;i<=N;i++){ Fact[i] = Fact[i-1] * i; Fact[i] %= mod; } if(K==0){ Console.WriteLine(Fact[N]); return; } int[] bc = new int[N]; int tot = N; long ans = 1; for(int i=0;i0) inc -= A[i-1]; int cnt = 0; for(int j=0;j> j)&1) == 1){ bc[j]++; cnt++;} if(bc[j]>1){ Console.WriteLine(0); return; } } ans *= Fact[cnt]; ans %= mod; tot -= cnt; } ans *= Fact[tot]; ans %= mod; Console.WriteLine(ans); } int N,K; long[] A; public Sol(){ var d = ria(); N = d[0]; K = d[1]; if(K>0)A = rla(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }