#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()
{
//	freopen("f.in","r",stdin); 
	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;}
				//printf("%lld %lld %lld\n",c[i-1]+1,x[i].c,ans);
				po=1;
				for (int j=1; j<=n; j++) d[x[j].po]=x[j].d;
				//if (d[1]==1&&d[2]==2&&d[3]==4) {printf("%lld %lld %lld %lld\n",K,ans,x[i-1].c+1,x[i].c);}
				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]=x[1].d-m; mii[cnt][2]=x[1].d;
				} else
				{
					//printf("%lld %lld %lld %lld\n",K,ans,mi,tot);
					po=mmp[e]; 
				//	printf("233\n");
					if (K-ans>mi) m=mi; else m=K-ans;
					//for (int j=1; j<=mii[po][0]; j++) printf("%d ",mii[po][j]); printf("\n");
					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];
							}
						}
					}
					//printf("%lld %lld %lld %lld\n",k,d[1],m,mii[po]);
					/*if (x[1].d-m<mii[po]) 
					{
						//printf("%lld %lld\n",mii[po],x[1].d);
						if (mii[po]>x[1].d) tot=(tot+m+1)%mod; else tot=(tot+mii[po]-x[1].d+m)%mod;
						//printf("%lld %lld %lld %lld %d\n",x[1].d,m,tot,mii[po],po);
						mii[po]=x[1].d-m;
					}*/
				}
				//printf("%lld %lld\n",x[i-1].c+1,x[i].c);
				//for (int j=1; j<=n; j++) printf("%lld %lld %lld %lld %lld\n",x[j].d,K,ans,mi,tot); printf("\n");
			}
			if (x[i].b-1<mi) mi=x[i].b-1; x[i].d--;
		}
	}
	printf("%lld\n",tot);
	return 0;
}

Measured memory_bytes: 108416