#include<cstdio>
#include<algorithm>
#include<cstring>
 
using namespace std;
 
const long long mod=1000000007;
 
int n,po,l,r,mid,ans1,ans2;
long long d[201],K,ma,k,a[201],mi,ans,tot,f[61][61][2],ff[61][61][2],t[61],tmp,len,m,mii[201][24401],le;
 
struct node
{
	long long b,c,d;
	int po;
}x[201];
 
int solve(long long ll,long long r)
{
	if (ll==0) return 0;
	if (ll==1) return 1;
	t[0]=0; ll--;
	while (ll) t[++t[0]]=ll%2,ll/=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];}
	ma*=2ll;
	sort(a+1,a+1+n);
	x[0].c=-1; tot=0; 
	memset(mii,0,sizeof(mii));
	for (k=1; K>=0&&k<=ma; k*=2ll,K--)
	{
		mi=(2e18);
		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;
				for (int j=2; j<=n; j++)
					if (d[j]!=d[j-1]) 
					{
						if (d[j]>d[j-1]+1) {po=0; break;}
						if (po==1) po=j;
						else {po=0; break;}
					}
				if (!po)
				{
					if (K-ans>mi) tot=(tot+mi+1)%mod;
					else tot=(tot+K-ans+1)%mod;
				} else
				{
					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;
}

Measured memory_bytes: 38656