#include <bits/stdc++.h>
 
using std::pair;
using std::vector;
using std::string;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
 
template<typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48; 
    return x *= f;
}

const int mo = 1e9 + 7;

ll T, n, k;

int get_mnb(ll l, ll r) {
    int res = 0;
    for(int i = 60; i >= 0; --i) {
        if((l >> i & 1) == (r >> i & 1)) 
            res += (l >> i & 1);
        else {
            res += bool (l & ((1ll << i) - 1)); 
            break;
        }
    }
    return res;
}

vector<pll> temp;
std::map<vector<ll>, vector<pll>> mp;
std::map<vector<ll>, vector<pll>> :: iterator it;

void out (vector<ll> x) {
    for(auto v : x) printf("%lld ", v);
    printf("\n");
}
void out (vector<pll> x) {
    for(auto v : x) printf("(%lld, %lld) ", v.fst, v.snd);
    printf("\n");
}

void calc(int x, ll tims) {
    vector<ll> b;
    if(tims < 0) return;

    for(int i = 0; i < n; ++i) b.pb(temp[i].snd - (i <= x));
    
    std::sort(b.begin(), b.end());
    if(b[0] < 0) return;

    for(int i = n-1; i > 0; --i) { b[i] -= b[i-1]; }
    ll t = b[0]; b[0] = 0;

    tims = std::min(tims, t);
    mp[b].pb(mp(t - tims, t));
}

vector<ll> a;

int main() {

        read(n), read(k); 
        temp.resize(n), a.resize(n);

        for(int i = 0; i < n; ++i) read(a[i]);
        std::sort(a.begin(), a.end());

        mp.clear();

        for(int i = 0; i <= 60; ++i) {

            ll bits = (1ll << i) - 1;
            for(int j = 0; j < n; ++j) temp[j] = mp(a[j] & bits, a[j] >> i);

            std::sort(temp.begin(), temp.end());

            ll lst = 0;
            for(int j = 0, nxt = 0; j < n; j = nxt + 1) {
                nxt = j;
                while(nxt < n-1 && temp[nxt + 1].fst == temp[j].fst) ++ nxt;

                calc(j-1, k - i - get_mnb(lst, temp[j].fst));
                lst = temp[j].fst + 1;
            }
        }

        int ans = 0;
        for(it = mp.begin(); it != mp.end(); ++ it) {
            // out(it -> fst);
            // out(it -> snd);

            temp = it -> snd;
            std::sort(temp.begin(), temp.end());

            ll l = temp[0].fst, r = temp[0].snd;

            for(int i = 1; i < (int) temp.size(); ++i) {

                if(temp[i].fst <= r) {
                    chkmax(r, temp[i].snd);
                } else {
                    ans = (ans + (r - l + 1) % mo) % mo;
                    l = temp[i].fst;
                    r = temp[i].snd;
                }
            }
            ans = (ans + (r - l + 1) % mo) % mo;
        }
        printf("%d\n", ans);
    

    return 0;
}
