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(); int[] arr = new int[k]; for (int i = 0; i < k; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); for (int i = 0; i < k - 1; i++) { if ((arr[i] & arr[i + 1]) != arr[i]) { System.out.println(0); return; } } 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; } }