import java.util.*; public class Main { static final int MOD = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); Num[] numbers = new Num[k + 2]; numbers[0] = new Num(0); for (int i = 1; i <= k; i++) { numbers[i] = new Num(sc.nextLong()); } numbers[k + 1] = new Num((1L << n) - 1); Arrays.sort(numbers); long ans = 1; for (int i = 1; i <= k + 1; i++) { if ((numbers[i - 1].number & numbers[i].number) != numbers[i - 1].number) { System.out.println(0); return; } ans *= kaijo(numbers[i].getPop() - numbers[i - 1].getPop()); ans %= MOD; } System.out.println(ans); } static class Num implements Comparable { long number; int pop; public Num(long number) { this.number = number; while (number > 0) { pop += number % 2; number /= 2; } } public int getPop() { return pop; } public int compareTo(Num another) { return pop - another.pop; } public String toString() { return number + ":" + pop; } } static long kaijo(long x) { if (x == 0) { return 1; } else { return x * kaijo(x - 1) % MOD; } } }