#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 3000000000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200010
vector<pair<long long, long long> >vecaa;
vector<pair<long long, long long> >vecbb;
map<long long, long long>mpa;
vector<long long>veca;
map<long long, long long>mpb;
vector<long long>vecb;
long long cnt[70];
vector<long long>c;
long long nik[100][100];


int main() {
	long long n, k;
	long long aa[N];
	vector<long long>a;
	bool bb[70];
	long long sz, x, y, z, kk;
	long long ss, tt, t, s;
	scanf("%lld %lld %lld %lld", &n, &k, &ss, &tt);
	if ((ss&tt) != ss) {
		printf("0\n");
		return 0;
	}
	f(i, 70)bb[i] = false;
	x = ss;
	y = tt;
	f(i, 70) {
		if ((x % 2 == 0) && (y % 2 == 1))bb[i] = true;
		x /= 2;
		y /= 2;
	}
	kk = 0;
	x = tt;
	y = 1;
	z = 0;
	f(j, 70) {
		if (bb[j]) {
			if (x % 2 == 1) {
				z += y;
			}
			kk++;
			y *= 2;
		}
		x /= 2;
	}
	t = z;
	f(i, n) {
		scanf("%lld", &x);
		if (((ss&x) == ss) && ((tt | x) == tt)) {
			y = 1;
			z = 0;
			f(j, 70) {
				if (bb[j]) {
					if (x % 2 == 1) {
						z += y;
					}
					y *= 2;
				}
				x /= 2;
			}
			a.push_back(z);
		}
	}
	n = a.size();
	f(i, kk) {
		x = 0;
		y = 1;
		f(j, n) {
			if (a[j] % 2 == 1)x += y;
			a[j] /= 2;
			y *= 2;
		}
		c.push_back(x);
	}
	nik[0][0] = 1;
	f(i, 60) {
		nik[i + 1][0] = 1;
		f(j, i) {
			nik[i + 1][j + 1] = nik[i][j] + nik[i][j + 1];
		}
		nik[i + 1][i + 1] = 1;
	}
	f(i, 55) {
		cnt[i] = 0;
		f(j, min(i,k)) {
			cnt[i] += nik[i][j + 1];
		}
	}
	if (t == 0) {
		printf("%lld\n", cnt[n]);
		return 0;
	}
  t=1;
  f(i,n)t*=2;
  t--;
	mpa[t] = 1;
	veca.push_back(t);

	f(i, kk) {
		sz = veca.size();
		vecbb.clear();
		f(j, sz) {
			x = veca[j];
			x &= c[i];
			if (x > 0) {
				vecbb.push_back(make_pair(x, mpa[veca[j]]));
			}
		}
		sz = vecb.size();
		vecaa.clear();
		f(j, sz) {
			x = vecb[j];
			x &= c[i];
			if (x > 0) {
				vecaa.push_back(make_pair(x, mpb[vecb[j]]));
			}
		}

		c[i] ^= t;

		sz = veca.size();
		f(j, sz) {
			x = veca[j];
			x &= c[i];
			if (x > 0) {
				vecbb.push_back(make_pair(x, mpa[veca[j]]));
			}
		}
		sz = vecb.size();
		f(j, sz) {
			x = vecb[j];
			x &= c[i];
			if (x > 0) {
				vecaa.push_back(make_pair(x, mpb[vecb[j]]));
			}
		}


		sz = vecaa.size();
		f(j, sz) {
			if (mpa[(vecaa[j].first)] == 0) {
				veca.push_back((vecaa[j].first));
				mpa[(vecaa[j].first)] = (vecaa[j].second);
			}
			else {
				y = mpa[(vecaa[j].first)];
				y += (vecaa[j].second);
				mpa[(vecaa[j].first)] = y;
			}
		}
		sz = vecbb.size();
		f(j, sz) {
			if (mpb[(vecbb[j].first)] == 0) {
				vecb.push_back((vecbb[j].first));
				mpb[(vecbb[j].first)] = (vecbb[j].second);
			}
			else {
				y = mpb[(vecbb[j].first)];
				y += (vecbb[j].second);
				mpb[(vecbb[j].first)] = y;
			}
		}
	}
	long long ans = 0;
	sz = veca.size();
	f(i, sz) {
		x = veca[i];
		y = mpa[x];
		z = 0;
		while (x > 0) {
			if (x % 2 == 1)z++;
			x /= 2;
		}
		while (y > 1000) {
			s = (cnt[z] * 1000) % MOD;
			ans = (ans + s) % MOD;
			y -= 1000;
		}
		s = (cnt[z] * y) % MOD;
		ans = (ans + s) % MOD;
	}
	sz = vecb.size();
	f(i, sz) {
		x = vecb[i];
		y = mpb[x];
		z = 0;
		while (x > 0) {
			if (x % 2 == 1)z++;
			x /= 2;
		}
		while (y > 1000) {
			s = (cnt[z] * 1000) % MOD;
			ans = (ans + MOD - s) % MOD;
			y -= 1000;
		}
		s = (cnt[z] * y) % MOD;
		ans = (ans + MOD - s) % MOD;
	}
	printf("%lld\n", ans);



	return 0;
}


Measured memory_bytes: 49976