using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static int N, K; const long MOD = 1000000007; static void Main() { string[] s = Console.ReadLine().Split(' '); N = int.Parse(s[0]); K = int.Parse(s[1]); if (K == 0) { Console.WriteLine(kaijou(N)); return; } long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); Array.Sort(a); long b = 0; long result = 1; for(int i = 0; i < K; i++) { if (!check(b, a[i])) { Console.WriteLine(0); return; } // Console.WriteLine(count(b, a[i])); result*= count(b, a[i]); result %= MOD; b = a[i]; } result *= count(b, MyPow(2, N)-1); Console.WriteLine(result % MOD); } static long count(long a,long b) { int cnt = 0; for(int i = 0; i < N; i++) { if (a % 2 b % 2) { return false; } a /= 2; b /= 2; } //Console.WriteLine("a"); return true; } static long MyPow(long a,long b) { long result = 1; while (b > 0) { if (b % 2 == 0) { a *= a; // a %= MOD; b /= 2; } else { result *= a; // result %= MOD; b--; } } return result; } static long kaijou(long n) { if (n == 0) { return 1; } else { return n * kaijou(n - 1) % MOD; } } }