#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(ll n){ string str(std::bitset<62>(n).to_string, std::allocator >()); int cnt=0; REP(i,62){ if(str[i]=='1')cnt++; } return cnt; } ll nPn(int n){ ll sum=1; rep(i,1,n+1){ sum*=i; sum%=mod; } return sum; } ll bainary(ll x){ ll 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]; ll ans=0; if(k==0){ ans=nPn(n); print(ans); return 0; } sort(a,a+k); rep(i,1,k){ if(check(a[i],a[i-1])==false){ print(0); return 0; } } int pre_cnt=binally_count(a[0]); print(pre_cnt); ans=nPn(pre_cnt); print(ans); rep(i,1,k){ int cnt=binally_count(a[i]); print(cnt); ans=(ans*(nPn(cnt-pre_cnt))%mod)%mod; pre_cnt=cnt; } print(ans); }