//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n,x;
vi s,prim;
int ret;
int facto[201];

ll powll(ll base,ll power){
    ll ans = 1;
    while (power){
        if (power&1) ans = (base*ans)%mod;
        base = (base*base)%mod;
        power >>= 1;
    }
    return ans;
}
int invs[201];

int dp[201][100010];

signed main(){
    facto[0] = 1;
    REPS(i,200) facto[i] = (facto[i-1] * i) % mod;
    REPS(i,200) invs[i] = powll(i,mod-2);

    I(n); I(x);
    s.resize(n);
    REP(i,n) I(s[i]);
    sort(all(s), greater<int>());

    dp[0][x] = 1;
    REP(i,n){
        REP(j,x+1){
            int prob = invs[n-i];
            dp[i+1][j] = (dp[i+1][j] + dp[i][j] * (1 + mod - prob)) % mod; 
            dp[i+1][j % s[i]] = (dp[i+1][j % s[i]] + dp[i][j] * prob) % mod; 
        }
    }
    int ret = 0;
    REP(j,s[n-1]) ret = ((dp[n][j] * j) + ret) % mod;
    cout << (ret * facto[n]) % mod << endl;
}
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 4e5 + 7;

int a[N], b[N], ok[N], okk[N], c[N], d[N], fail[N];
int n;

void goo() {
	for(int i=1,j=fail[0]=-1;i<n;i++) {
		while(j >= 0 && d[j+1] != d[i])
			j = fail[j];
		if(d[j+1] == d[i])
			j++;
		fail[i] = j;
	}
	for(int i=0,j=-1;i<2*n;i++) {
		while(j >= 0 && (j == n - 1 || d[j+1] != c[i]))
			j = fail[j];
		if(d[j+1] == c[i])
			j++;
		if(j == n - 1) okk[i-n+1] = 1;
	}
}

void go(int bit) {
	for(int i=0;i<2*n;i++)
		c[i] = a[i] >> bit & 1;
	for(int i=0;i<n;i++)
		d[i] = b[i] >> bit & 1;
	for(int i=0;i<n;i++) okk[i] = 0;
	goo();
	for(int i=0;i<n;i++)
		d[i] ^= 1;
	goo();
	for(int i=0;i<n;i++) ok[i] &= okk[i];
}

signed main()
{
	IO_OP;	

	cin >> n;
	for(int i=0;i<n;i++) {
		cin >> a[i];
		a[i+n] = a[i];
		ok[i] = 1;
	}	
	for(int i=0;i<n;i++)
		cin >> b[i];
	for(int i=0;i<30;i++)
		go(i);
	for(int i=0;i<n;i++)
		if(ok[i]) cout << i << " " << (a[i] ^ b[0]) << endl;
}



