#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000007; //10^9+7 int binally_count(int n){ string str(std::bitset<32>(n).to_string, std::allocator >()); int cnt=0; REP(i,32){ if(str[i]=='1')cnt++; } return cnt; } ll nPn(int n){ int sum=1; rep(i,1,n+1)sum*=i; return sum; } int bainary(ll x){ int y,i,ans; ans=0; i=0; while (x>0) { y=x%2; ans=ans+y*pow(10,i); x=x/2; i+=1; } return ans; } bool check(ll a,ll b){ string ab=to_string(bainary(a)); string bb=to_string(bainary(b)); while(ab.size()!=bb.size()){bb="0"+bb;} REP(i,ab.size()){ if(ab[i]=='0'&&bb[i]=='1'){ return false; } } return true; } int main(){ int n,k; cin>>n>>k; ll a[61]; REP(i,n)cin>>a[i]; int ans=0; if(k==0){ ans=nPn(n); print(ans); return 0; } sort(a,a+k); int pre_cnt=binally_count(a[0]); ans=nPn(pre_cnt); rep(i,1,k){ int cnt=binally_count(a[i]); if(pre_cnt==cnt||cnt-pre_cnt<0||check(a[i],a[i-1])==false){ print(0); return 0; } ans*=nPn(cnt-pre_cnt); pre_cnt=cnt; } print(ans); }