def cmb(n, r, mod):#コンビネーションの高速計算　

    if ( r<0 or r>n ):

        return 0

    r = min(r, n-r)

    return (g1[n] * g2[r] * g2[n-r])%mod



mod = 10**18+7 #出力の制限

N = 50

g1 = [1, 1] # 元テーブル

g2 = [1, 1] #逆元テーブル

inverse = [0, 1] #逆元テーブル計算用テーブル



for i in range( 2, N + 1 ):

    g1.append( ( g1[-1] * i ) % mod )

    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )

    g2.append( (g2[-1] * inverse[-1]) % mod )



N,K,T,S=list(map(int,input().split()))

a=list(map(int,input().split()))



must0=[i for i in range(18) if S>>i &1==0]

must1=[i for i in range(18) if T>>i &1==1]



A=[]

for val in a:

    check=True

    for j in must0:

        check=check&(val>>j &1==0)

    for j in must1:

        check=check&(val>>j &1==1)

    if check:

        A.append(val)



if not A:

    print((0))

    exit()



bit=[]

for i in range(18):

    if i not in must0 and i not in must1:

        bit.append(i)



for i in range(len(A)):

    temp=0

    for j in range(len(bit)):

        temp+=(A[i]>>bit[j] &1==1)*2**j

    A[i]=temp



ans=0

n=len(bit)

for i in range(2**n):

    dic={}

    for a in A:

        val=a&i

        if val not in dic:

            dic[val]=0

        dic[val]+=1

    temp=0

    for val in dic:

        for j in range(1,min(K,dic[val])+1):

            temp+=cmb(dic[val],j,mod)

    popcount=0

    for j in range(n):

        popcount+=(i>>j &1)

    ans+=temp*(-1)**popcount



print((ans%mod))
def popcount(x):

    x = x - ((x >> 1) & 0x55555555)

    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f

    x = x + (x >> 8)

    x = x + (x >> 16)

    return x & 0x0000007f



cmb=[[0 for i in range(51)] for j in range(51)]

cmb[0][0]=1

for i in range(51):

    for j in range(51):

        if i!=50 and j!=50:

            cmb[i+1][j+1]+=cmb[i][j]

        if i!=50:

            cmb[i+1][j]+=cmb[i][j]



for i in range(1,51):

    for j in range(2,51):

        cmb[i][j]+=cmb[i][j-1]



N,K,T,S=list(map(int,input().split()))

a=list(map(int,input().split()))



must0=[i for i in range(18) if S>>i &1==0]

must1=[i for i in range(18) if T>>i &1==1]



A=[]

for val in a:

    check=True

    for j in must0:

        check=check&(val>>j &1==0)

    for j in must1:

        check=check&(val>>j &1==1)

    if check:

        A.append(val)



if not A:

    print((0))

    exit()



bit=[]

for i in range(18):

    if i not in must0 and i not in must1:

        bit.append(i)



for i in range(len(A)):

    temp=0

    for j in range(len(bit)):

        temp+=(A[i]>>bit[j] &1==1)*2**j

    A[i]=temp



ans=0

n=len(bit)

data=[0]*(2**n)

for i in range(2**n):

    t=set([])

    for a in A:

        data[a&i]+=1

        t.add(a&i)

    temp=0

    for val in t:

        temp+=cmb[data[val]][min(K,data[val])]

    ans+=temp*(-1)**popcount(i)

    for val in t:

        data[val]=0



print(ans)

def cmb(n, r, mod):  # コンビネーションの高速計算
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return (g1[n] * g2[r] * g2[n - r]) % mod


mod = 10**18 + 7  # 出力の制限
N = 50
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)
N, K, T, S = list(map(int, input().split()))
a = list(map(int, input().split()))
must0 = [i for i in range(18) if S >> i & 1 == 0]
must1 = [i for i in range(18) if T >> i & 1 == 1]
A = []
for val in a:
    check = True
    for j in must0:
        check = check & (val >> j & 1 == 0)
    for j in must1:
        check = check & (val >> j & 1 == 1)
    if check:
        A.append(val)
if not A:
    print((0))
    exit()
bit = []
for i in range(18):
    if i not in must0 and i not in must1:
        bit.append(i)
for i in range(len(A)):
    temp = 0
    for j in range(len(bit)):
        temp += (A[i] >> bit[j] & 1 == 1) * 2**j
    A[i] = temp
ans = 0
n = len(bit)
for i in range(2**n):
    dic = {}
    for a in A:
        val = a & i
        if val not in dic:
            dic[val] = 0
        dic[val] += 1
    temp = 0
    for val in dic:
        for j in range(1, min(K, dic[val]) + 1):
            temp += cmb(dic[val], j, mod)
    popcount = 0
    for j in range(n):
        popcount += i >> j & 1
    ans += temp * (-1) ** popcount
print((ans % mod))

def popcount(x):
    x = x - ((x >> 1) & 0x55555555)
    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
    x = (x + (x >> 4)) & 0x0F0F0F0F
    x = x + (x >> 8)
    x = x + (x >> 16)
    return x & 0x0000007F


cmb = [[0 for i in range(51)] for j in range(51)]
cmb[0][0] = 1
for i in range(51):
    for j in range(51):
        if i != 50 and j != 50:
            cmb[i + 1][j + 1] += cmb[i][j]
        if i != 50:
            cmb[i + 1][j] += cmb[i][j]
for i in range(1, 51):
    for j in range(2, 51):
        cmb[i][j] += cmb[i][j - 1]
N, K, T, S = list(map(int, input().split()))
a = list(map(int, input().split()))
must0 = [i for i in range(18) if S >> i & 1 == 0]
must1 = [i for i in range(18) if T >> i & 1 == 1]
A = []
for val in a:
    check = True
    for j in must0:
        check = check & (val >> j & 1 == 0)
    for j in must1:
        check = check & (val >> j & 1 == 1)
    if check:
        A.append(val)
if not A:
    print((0))
    exit()
bit = []
for i in range(18):
    if i not in must0 and i not in must1:
        bit.append(i)
for i in range(len(A)):
    temp = 0
    for j in range(len(bit)):
        temp += (A[i] >> bit[j] & 1 == 1) * 2**j
    A[i] = temp
ans = 0
n = len(bit)
data = [0] * (2**n)
for i in range(2**n):
    t = set([])
    for a in A:
        data[a & i] += 1
        t.add(a & i)
    temp = 0
    for val in t:
        temp += cmb[data[val]][min(K, data[val])]
    ans += temp * (-1) ** popcount(i)
    for val in t:
        data[val] = 0
print(ans)

-def cmb(n, r, mod):  # コンビネーションの高速計算 -    if r < 0 or r > n: -        return 0 -    r = min(r, n - r) -    return (g1[n] * g2[r] * g2[n - r]) % mod +def popcount(x): +    x = x - ((x >> 1) & 0x55555555) +    x = (x & 0x33333333) + ((x >> 2) & 0x33333333) +    x = (x + (x >> 4)) & 0x0F0F0F0F +    x = x + (x >> 8) +    x = x + (x >> 16) +    return x & 0x0000007F -mod = 10**18 + 7  # 出力の制限 -N = 50 -g1 = [1, 1]  # 元テーブル -g2 = [1, 1]  # 逆元テーブル -inverse = [0, 1]  # 逆元テーブル計算用テーブル -for i in range(2, N + 1): -    g1.append((g1[-1] * i) % mod) -    inverse.append((-inverse[mod % i] * (mod // i)) % mod) -    g2.append((g2[-1] * inverse[-1]) % mod) +cmb = [[0 for i in range(51)] for j in range(51)] +cmb[0][0] = 1 +for i in range(51): +    for j in range(51): +        if i != 50 and j != 50: +            cmb[i + 1][j + 1] += cmb[i][j] +        if i != 50: +            cmb[i + 1][j] += cmb[i][j] +for i in range(1, 51): +    for j in range(2, 51): +        cmb[i][j] += cmb[i][j - 1] +data = [0] * (2**n) -    dic = {} +    t = set([]) -        val = a & i -        if val not in dic: -            dic[val] = 0 -        dic[val] += 1 +        data[a & i] += 1 +        t.add(a & i) -    for val in dic: -        for j in range(1, min(K, dic[val]) + 1): -            temp += cmb(dic[val], j, mod) -    popcount = 0 -    for j in range(n): -        popcount += i >> j & 1 -    ans += temp * (-1) ** popcount -print((ans % mod)) +    for val in t: +        temp += cmb[data[val]][min(K, data[val])] +    ans += temp * (-1) ** popcount(i) +    for val in t: +        data[val] = 0 +print(ans)