#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<iostream>
#include<map>
 
using namespace std;
 
const long long mod=1000000007;
 
int n,po,l,r,mid,ans1,ans2;
long long xx,d[201],K,ma,k,a[201],mi,ans,tot,f[61][61][2],ff[61][61][2],t[61],tmp,len,m,mii[12001][1001],le,cnt;
string e;
 
struct node
{
	long long b,c,d;
	int po;
}x[201];
 
map<string,int> mmp;
map<string,int>::iterator it;
 
int solve(long long l,long long r)
{
	if (l==0) return 0;
	if (l==1) return 1;
	t[0]=0; l--;
	while (l) t[++t[0]]=l%2,l/=2; len=t[0];
	for (int i=1; i<=(t[0]/2); i++) tmp=t[i],t[i]=t[t[0]-i+1],t[t[0]-i+1]=tmp;
	memset(f,0,sizeof(f));
	f[0][0][1]=1;
	for (int i=1; i<=t[0]; i++)
		for (int l=0; l<=60; l++)
			for (int j=0; j<=1&&j+l<=60; j++)
				if (j>t[i])
					f[i][l+j][0]+=f[i-1][l][0];
				else
				if (j<t[i])
					f[i][l+j][0]+=f[i-1][l][0]+f[i-1][l][1];
				else
					f[i][l+j][0]+=f[i-1][l][0],f[i][l+j][1]+=f[i-1][l][1];
	t[0]=0;
	while (r) t[++t[0]]=r%2,r/=2;
	for (int i=1; i<=(t[0]/2); i++) tmp=t[i],t[i]=t[t[0]-i+1],t[t[0]-i+1]=tmp;
	memset(ff,0,sizeof(ff));
	ff[0][0][1]=1;
	for (int i=1; i<=t[0]; i++)
		for (int l=0; l<=60; l++)
			for (int j=0; j<=1&&j+l<=60; j++)
				if (j>t[i])
					ff[i][l+j][0]+=ff[i-1][l][0];
				else
				if (j<t[i])
					ff[i][l+j][0]+=ff[i-1][l][0]+ff[i-1][l][1];
				else 
					ff[i][l+j][0]+=ff[i-1][l][0],ff[i][j+l][1]+=ff[i-1][l][1];
	for (int i=1; i<=60; i++)
		if (f[len][i][0]+f[len][i][1]!=ff[t[0]][i][0]+ff[t[0]][i][1]) return i;
}
 
bool cmp(node a,node b) {return a.c<b.c;}
 
int main()
{
	scanf("%d%lld",&n,&K); ma=0;
	for (int i=1; i<=n; i++) {scanf("%lld",&a[i]); if (a[i]>ma) ma=a[i];}
	sort(a+1,a+1+n);
	mmp.clear(); ma*=2ll;
	x[0].c=-1; tot=0; cnt=0;
	memset(mii,0,sizeof(mii));
	for (k=1; K>=0&&k<=ma; k*=2ll,K--)
	{
		mi=(1e18)+1;
		for (int i=1; i<=n; i++) 
		{
			x[i].c=a[i]%k; x[i].b=a[i]/k; x[i].d=x[i].b; x[i].po=i;
			if (x[i].b<mi) mi=x[i].b;
		}
		sort(x+1,x+n+1,cmp);
		for (int i=1; i<=n; i++)
		{
			if (mi<0) break;
			if (x[i].c!=x[i-1].c)
			{
				ans=solve(x[i-1].c+1,x[i].c);
				if (ans>K) {if (x[i].b-1<mi) mi=x[i].b-1; x[i].d--; continue;}
				po=1;
				for (int j=1; j<=n; j++) d[x[j].po]=x[j].d;
				e="";
				for (int j=1; j<n; j++) 
				{
					xx=d[j+1]-d[j]; t[0]=0;
					while (xx) t[++t[0]]=xx%94,xx/=94;
					for (int k=1; k<=t[0]; k++) e=e+(char)(t[k]+33);
					e=e+" ";
				}
				it=mmp.find(e);
				if (it==mmp.end()) 
				{
					if (K-ans>mi) tot=(tot+mi+1)%mod;
					else tot=(tot+K-ans+1)%mod;
					cnt++;
					mmp.insert(make_pair(e,cnt));
					mii[cnt][0]=2;
					if (K-ans>mi) m=mi; else m=K-ans;
					mii[cnt][1]=d[1]-m; mii[cnt][2]=d[1];
				} else
				{
					po=mmp[e]; 
					if (K-ans>mi) m=mi; else m=K-ans;
					l=1; r=mii[po][0]; ans1=0; le=d[1]-m; if (le<0) le=0;
					while (l<=r)
					{
						mid=(l+r)>>1;
						if (mii[po][mid]<le) ans1=mid,l=mid+1; else r=mid-1;
					}
					l=1; r=mii[po][0]; ans2=0;
					while (l<=r)
					{
						mid=(l+r)>>1;
						if (mii[po][mid]<=d[1]) ans2=mid,l=mid+1; else r=mid-1;
					}
					if (ans1==ans2)
					{
						if (!(ans1&1)) 
						{
							tot=(tot+d[1]-le+1)%mod;
							mii[po][0]+=2;
							for (int j=mii[po][0]; j>ans1+2; j--) mii[po][j]=mii[po][j-2];
							mii[po][ans1+2]=d[1]; mii[po][ans1+1]=le;
						}
					} else
					{
						if (ans1&1)
						{
							if (ans2&1)
							{
								for (int j=ans1+1; j<ans2; j+=2) tot=(tot+mii[po][j+1]-mii[po][j]-1)%mod;
								mii[po][0]-=ans2-ans1;
								for (int j=ans1+1; j<=mii[po][0]; j++) mii[po][j]=mii[po][j+ans2-ans1];
							} else
							{
								for (int j=ans1+1; j<ans2; j+=2) tot=(tot+mii[po][j+1]-mii[po][j]-1)%mod;
								tot=(tot+d[1]-mii[po][ans2])%mod;
								mii[po][0]-=ans2-ans1-1; mii[po][ans1+1]=d[1];
								for (int j=ans1+2; j<=mii[po][0]; j++) mii[po][j]=mii[po][j+ans2-ans1-1];
							}
						} else
						{
							if (ans2&1)
							{
								tot=(tot+mii[po][ans1+1]-le)%mod;
								for (int j=ans1+2; j<ans2; j+=2) tot=(tot+mii[po][j+1]-mii[po][j]-1)%mod;
								mii[po][0]-=ans2-ans1-1; mii[po][ans1+1]=le;
								for (int j=ans1+2; j<=mii[po][0]; j++) mii[po][j]=mii[po][j+ans2-ans1-1];
							} else
							{
								tot=(tot+mii[po][ans1+1]-le)%mod; tot=(tot+d[1]-mii[po][ans2])%mod;
								for (int j=ans1+2; j<ans2; j+=2) tot=(tot+mii[po][j+1]-mii[po][j]-1)%mod;
								mii[po][0]-=ans2-ans1-2; mii[po][ans1+1]=le; mii[po][ans1+2]=d[1];
								for (int j=ans1+3; j<=mii[po][0]; j++) mii[po][j]=mii[po][j+ans2-ans1-2];
							}
						}
					}
				}
			}
			if (x[i].b-1<mi) mi=x[i].b-1; x[i].d--;
		}
	}
	printf("%lld\n",tot);
	return 0;
}