import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); long[] arr = new long[k]; for (int i = 0; i < k; i++) { arr[i] = sc.nextLong(); } Arrays.sort(arr); for (int i = 0; i < k - 1; i++) { if ((arr[i] & arr[i + 1]) != arr[i]) { System.out.println(0); return; } } if (k > 0 && arr[k - 1] == (long)(Math.pow(2, n)) - 1) { k--; } if (k > 0 && arr[0] == 0) { k--; } System.out.println(kaijo(n - k)); } static long kaijo(long x) { long ret = 1; int mod = 1000000007; for (long i = 1; i <= x; i++) { ret *= i; ret %= mod; } return ret; } }