import java.util.ArrayList; import java.util.Scanner; import java.util.TreeMap; public class Muikashirazu { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(),k = s.nextInt(); if(k == 0){ int p = 1; for(int i = 1;i <= N;i++){ p *= i; } System.out.println(p); }else{ long count = 1; TreeMap bit = new TreeMap<>(); for(int i = 0;i < k;i++){ int a = s.nextInt(); int b = Integer.bitCount(a); if(bit.containsKey(b)){ count = 0; }else{ bit.put(b, Integer.toBinaryString(a)); } } s.close(); //System.out.println(bit); //System.out.println(count); int n = 1; String str = "", str2; for(int i = 1;i <= bit.lastKey();i++){ str2 = bit.get(i); if(str != "" && str2 != null){ //System.out.println(str + " " + str2); ArrayList p = new ArrayList<>(); for(int j = 0;j