#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
const int MOD = 1000000007;
int N,tot;
int64 K,a[205],rk[205];
vector<pair<int64,int64> > range;
int inc(int a,int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
struct node {
    int64 c[205],u;
    friend bool operator == (const node &a,const node &b) {
	for(int i = 2 ; i <= N ; ++i) {
	    if(a.c[i] != b.c[i]) return false;
	}
	return true;
    }
    friend bool operator < (const node &a,const node &b) {
	for(int i = 2 ; i <= N ; ++i) {
	    if(a.c[i] != b.c[i]) return a.c[i] < b.c[i];
	}
	return false;
    }
    friend bool operator != (const node &a,const node &b) {
	return !(a == b);
    }
}seq[205 * 62];

int minpopcount(int64 l,int64 r) {
    int dp[2][5];
    int cur = 0;
    for(int i = 0 ; i <= 3 ; ++i) dp[cur][i] = 1000000;
    dp[cur][3] = 0;
    for(int i = 60 ; i >= 0 ; --i) {
	for(int j = 0 ; j <= 3 ; ++j) dp[cur ^ 1][j] = 100000;
	int x = (l >> i) & 1,y = (r >> i) & 1;
	for(int s = 0 ; s <= 3 ; ++s) {
	    for(int k = 0 ; k <= 1 ; ++k) {
		int t = 0;
		if(s & 1) {
		    if(k < x) continue;
		    if(k == x) t |= 1;
		}
		if(s & 2) {
		    if(k > y) continue;
		    if(k == y) t |= 2;
		}
		dp[cur ^ 1][t] = min(dp[cur][s] + k,dp[cur ^ 1][t]);
	    }
	}
	cur ^= 1;
    }
    int res = 100000;
    for(int i = 0 ; i <= 3 ; ++i) {
	res = min(res,dp[cur][i]);
    }
    return res;
}
void Insert(int64 l,int64 r,int k) {
    int64 rem = K - k - minpopcount(l,r);
    if(rem < 0) return;
    int64 t = 1;
    while(k--) t *= 2;
    ++tot;
    for(int i = 1 ; i <= N ; ++i) {
	seq[tot].c[i] = a[i] / t;
	if(a[i] % t < l)  {
	    seq[tot].c[i] -= 1;
	    if(seq[tot].c[i] < 0) {--tot;return;} 
	}
	rem = min(rem,seq[tot].c[i]);
    }
    seq[tot].u = rem;
    for(int i = N ; i >= 2 ; --i) {
	seq[tot].c[i] = seq[tot].c[i] - seq[tot].c[i - 1];
    }
}
void Solve() {
    read(N);read(K);
    int64 mv = 0;
    for(int i = 1 ; i <= N ; ++i) {read(a[i]);mv = max(mv,a[i]);}
    int up = 0;
    while(mv) {++up;mv >>= 1;}
    int64 t = 1;
    for(int i = 0 ; i <= up ; ++i) {
	for(int j = 1 ; j <= N ; ++j) {
	    rk[j] = a[j] % t;
	}
	sort(rk + 1,rk + N + 1);
	rk[N + 1] = t - 1;
	Insert(0,rk[1],i);
	for(int j = 2 ; j <= N + 1 ; ++j) {
	    if(rk[j] != rk[j - 1]) Insert(rk[j - 1] + 1,rk[j],i);
	}
	t *= 2;
    }
    sort(seq + 1,seq + tot + 1);
    range.pb(mp(seq[1].c[1] - seq[1].u,seq[1].c[1]));
    int ans = 0;
    for(int i = 2 ; i <= tot + 1; ++i) {
	if(i == tot + 1 || seq[i] != seq[i - 1]) {
	    sort(range.begin(),range.end());
	    int64 st = range[0].fi,ed = range[0].se;
	    for(int k = 1 ; k < range.size() ; ++k) {
		if(range[k].fi > ed) {
		    ans = inc(ans,(ed - st + 1) % MOD);
		    st = range[k].fi;ed = range[k].se;
		}
		else ed = max(range[k].se,ed);
	    }
	    ans = inc(ans,(ed - st + 1) % MOD);
	    range.clear();
	}
	range.pb(mp(seq[i].c[1] - seq[i].u,seq[i].c[1]));
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 16640