// Slower C++ solution:
//Create Time: 2018-05-05 16:45:20

#include <iostream>

#include <cstdio>

#include <cstring>

#include <string>

#include <cmath>

#include <algorithm>

#include <vector>

#include <cstdlib>

#include <sstream>

#include <fstream>

#include <functional>

#include <list>

#include <deque>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <bitset>

#include <cctype>

#include <ctime>

#include <utility>

#include <complex>

#include <cassert>

#include <climits>

#include <iterator>

#include <tuple>

using namespace std;

#define snuke(i,x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)

#define rep(i,a,n) for (int i=(a);i<(n);i++)

#define per(i,n,a) for (int i=(n)-1;i>=(a);i--)

// #define OUT(x) std::cout<<(#x)<<":"<<(x)<<std::endl

// #define TST(x) std::cout<<(#x)<<":"<<(x)<<" "

#define OUT(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("\n",_it,args);}

#define TST(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("",_it,args);}

#define SZ(v) ((int)(v).size())

#define all(v) (v).begin(), (v).end()

#define unq(x) sort(all(x)),(x).erase(unique(all(x)),(x).end())

#define mem(f,x) memset((f), (x), sizeof(f))

#define clr(f) mem(f,0)

#define x first

#define y second

#define mp make_pair

#define pb push_back

#define mt make_tuple

#define eb emplace_back

#define DEBUG

void OUT_TST(string s,istream_iterator<string> it) {cerr<<s;}

template<typename T, typename... Args> void OUT_TST(string s,istream_iterator<string> it,T a,Args... args){cerr<<*it<<"="<<a<<" ";OUT_TST(s,++it,args...);}

template<class T> void rd(T&ret){ret=0;bool ok=0,u=0;for(;;){int c=getchar();if(c>='0'&&c<='9')ret=(ret<<3)+(ret<<1)+c-'0',ok=1;else if(c=='-')u=1;else if(ok){if(u)ret*=-1;return;}}}

long long powmod(long long p,long long n,long long mod){long long ret=1;for(;n;n>>=1){if(n&1)ret=ret*p%mod;p=p*p%mod;}return ret;}

template <class T> bool chmin(T& a, const T &b) {return b < a? a = b, 1: 0;}

template <class T> bool chmax(T& a, const T &b) {return b > a? a = b, 1: 0;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}

typedef long long ll;

typedef pair<int, int> pii;

typedef vector<int> vi;

typedef vector<pii > vii;

typedef tuple<int,int,int> tp;

/****head****/

typedef pair<ll,ll> pll;

const ll mod=(ll)1e9+7;

ll an[222],cn[222],stk[222];

int n,top;

ll K;

map<vector<ll>,vector<pll> > has;

bool ok(ll x,int t,ll op){

    rep(i,0,t){

        if(op&1){

            if(x<1)return 0;

            x-=1;

        }

        x>>=1;

        op>>=1;

    }

    return 1;

}

int count(ll a,ll b){

    if(a==-1)return 0;

    while(a!=b){

        a>>=1;

        b>>=1;

    }

    return __builtin_popcount(a)+1;

}

int main(){

    cin>>n>>K;

    rep(i,0,n)cin>>an[i];

    sort(an,an+n);

    vector<ll> bn(n,0);

    rep(t,0,K+1){

        ll p2=1ll<<t;

        if(p2/2>an[n-1]) break;

        top=0;

        rep(i,0,n){

            // bn[i]=an[i]/p2;

            // cn[i]=an[i]%p2;

            stk[top++]=an[i]%p2;

        }

        stk[top++]=-1;stk[top++]=p2-1;

        sort(stk,stk+top);

        top=unique(stk,stk+top)-stk;

        rep(i,0,top-1){

            ll yu=stk[i]+1;

            if(!ok(an[0],t,yu))continue;

            ll left=K-t-count(stk[i],stk[i+1]);

            if(left<0)continue;

            rep(j,0,n)bn[j]=(an[j]-yu)/p2;

            rep(j,1,n)bn[j]-=bn[0];

            ll r=bn[0],l=r-left;chmax(l,0ll);

            bn[0]=0;

            auto it=has.find(bn);

            if(it==has.end()) {

                has.emplace(bn,vector<pll>());

                it=has.find(bn);

            }

            it->y.emplace_back(-r,l);

        }

    }

    ll ans=0;

    for(auto i:has){

        // puts("---------------------------------------------");

        // for(auto j:i.x)printf("%lld ",j);puts("");

        ll last=(ll)2e18;

        auto &p=i.y;

        sort(all(p));

        rep(j,0,SZ(p)){

            if(j && p[j-1].x==p[j].x)continue;

            ll r=-p[j].x,l=p[j].y;

            chmin(r,last-1);

            if(l<=r)ans+=(r-l+1)%mod;

            chmin(last,l);

            // OUT(-p[j].x,p[j].y,ans);

        }

    }

    ans%=mod;

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.3777114171007403x):
//Create Time: 2018-05-05 16:45:20

#include <iostream>

#include <cstdio>

#include <cstring>

#include <string>

#include <cmath>

#include <algorithm>

#include <vector>

#include <cstdlib>

#include <sstream>

#include <fstream>

#include <functional>

#include <list>

#include <deque>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <bitset>

#include <cctype>

#include <ctime>

#include <utility>

#include <complex>

#include <cassert>

#include <climits>

#include <iterator>

#include <tuple>

using namespace std;

#define snuke(i,x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)

#define rep(i,a,n) for (int i=(a);i<(n);i++)

#define per(i,n,a) for (int i=(n)-1;i>=(a);i--)

// #define OUT(x) std::cout<<(#x)<<":"<<(x)<<std::endl

// #define TST(x) std::cout<<(#x)<<":"<<(x)<<" "

#define OUT(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("\n",_it,args);}

#define TST(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("",_it,args);}

#define SZ(v) ((int)(v).size())

#define all(v) (v).begin(), (v).end()

#define unq(x) sort(all(x)),(x).erase(unique(all(x)),(x).end())

#define mem(f,x) memset((f), (x), sizeof(f))

#define clr(f) mem(f,0)

#define x first

#define y second

#define mp make_pair

#define pb push_back

#define mt make_tuple

#define eb emplace_back

#define DEBUG

void OUT_TST(string s,istream_iterator<string> it) {cerr<<s;}

template<typename T, typename... Args> void OUT_TST(string s,istream_iterator<string> it,T a,Args... args){cerr<<*it<<"="<<a<<" ";OUT_TST(s,++it,args...);}

template<class T> void rd(T&ret){ret=0;bool ok=0,u=0;for(;;){int c=getchar();if(c>='0'&&c<='9')ret=(ret<<3)+(ret<<1)+c-'0',ok=1;else if(c=='-')u=1;else if(ok){if(u)ret*=-1;return;}}}

long long powmod(long long p,long long n,long long mod){long long ret=1;for(;n;n>>=1){if(n&1)ret=ret*p%mod;p=p*p%mod;}return ret;}

template <class T> bool chmin(T& a, const T &b) {return b < a? a = b, 1: 0;}

template <class T> bool chmax(T& a, const T &b) {return b > a? a = b, 1: 0;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}

typedef long long ll;

typedef pair<int, int> pii;

typedef vector<int> vi;

typedef vector<pii > vii;

typedef tuple<int,int,int> tp;

/****head****/

const ll mod=(ll)1e9+7;

ll an[222],bn[222],cn[222],stk[222];

int n,top;

ll K;

bool ok(ll x,int t,ll op){

    rep(i,0,t){

        if(op&1){

            if(x<1)return 0;

            x-=1;

        }

        x>>=1;

        op>>=1;

    }

    return 1;

}

int count(ll a,ll b){

    if(a==-1)return 0;

    while(a!=b){

        a>>=1;

        b>>=1;

    }

    return __builtin_popcount(a)+1;

}

int main(){

    cin>>n>>K;

    rep(i,0,n)cin>>an[i];

    sort(an,an+n);

    ll ans=0;

    rep(t,0,K+1){

        ll p2=1ll<<t;

        if(p2>an[n-1]){

            ++ans;break;

        }

        top=0;

        rep(i,0,n){

            bn[i]=an[i]/p2;

            cn[i]=an[i]%p2;

            stk[top++]=cn[i];

        }

        stk[top++]=-1;

        sort(stk,stk+top);

        top=unique(stk,stk+top)-stk;

        bool add1=0;

        if(stk[top-1]!=p2-1){

            stk[top++]=p2-1;

            add1=1;

        }

        bool fg=0,minus1=0;

        // rep(i,0,top)TST(stk[i]);puts("");

        rep(i,0,top-1){

            if(i==top-2 && minus1 && add1)continue;

            // OUT(t,stk[i]+1);

            if(!ok(an[0],t,stk[i]+1))continue;

            // OUT(t,stk[i]+1);

            ll res=K-t-count(stk[i],stk[i+1]);

            if(res<0)continue;

            ll mi=(an[0]-stk[i]-1)/p2, mx=(an[n-1]-stk[i]-1)/p2;

            if(i==0 && mi!=0)minus1=1;

            if(mi==0){

                ++ans;

                if(mx==0) fg=1;

            } else {

                chmin(res,mi);

                if(mx==mi+1 && (mi&1))chmin(res,mi/2);

                if(mx==mi)chmin(res,mi-mi/2-1);

                ans+=(res+1ll)%mod;

            }

            // OUT(t,stk[i]+1,ans);

        }

        if(fg)break;

    }

    ans%=mod;

    cout<<ans<<endl;

    return 0;

}