import java.io.*; import java.util.*; public class Main_yukicoder462 { private static Scanner sc; private static Printer pr; private static void solve() { final int MOD = 1_000_000_007; int n = sc.nextInt(); int k = sc.nextInt(); long[] a = new long[k]; for (int i = 0; i < k; i++) { a[i] = sc.nextLong(); } Set hs = new TreeSet<>(); for (int i = 0; i < k; i++) { int tmp = Long.bitCount(a[i]); if (hs.contains(tmp)) { pr.println(0); return; } else { hs.add(tmp); } } hs.add(0); hs.add(n); long ret = 1; List al = new ArrayList<>(hs); Collections.sort(al); for (int i = 1, size = al.size(); i < size; i++) { int tmp = al.get(i) - al.get(i - 1); for (int j = 1; j <= tmp; j++) { ret = ret * j % MOD; } } pr.println(ret); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }