#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

class XorShift {
	unsigned int x, y, z, w, t;
public:
	XorShift() {
		x = 133553533;
		y = 314867339;
		z = 664298413;
		w = 999999937;
		t = 0;
	}
	unsigned int rand() {
		t = x ^ (x << 11);
		x = y;
		y = z;
		z = w;
		w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
		return w & 0x7fffffff;
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	XorShift xs;
	cin >> N >> K;
	//for (int loop = 0; loop < 100; loop++) {
		vector<long long int>v(N);
		for (auto &i : v)cin >> i;
		//for (int i = 0; i < N; i++)v[i] = xs.rand() & 31;
		sort(v.begin(), v.end());
		//for (auto i : v)cout << i << " ";
		//cout << endl;
		//set<vector<long long int>>vs;
		//for (int i = 0; i < pow(3, K); i++) {
		//	auto w = v;
		//	int box = i;
		//	for (int j = 0; j < K; j++) {
		//		if (box % 3 == 1) {
		//			for (auto &k : w)k >>= 1;
		//		}
		//		else if (box % 3 == 2) {
		//			if (w.front())for (auto &k : w)k--;
		//		}
		//		box /= 3;
		//	}
		//	vs.insert(w);
		//}
		//cout << vs.size() << " ";
		map<vector<long long int>, set<pair<long long int, long long int>>>mp;
		for (int i = 0; i <= 60; i++) {
			//cout << "loop " << i << endl;
			vector<long long int>box;
			long long int st = 0;
			for (int j = 0; j < N; j++) {
				box.push_back(v[j] & ((1LL << i) - 1));
			}
			//box.push_back(0);
			sort(box.begin(), box.end());
			box.push_back((1LL << i) - 1);
			for (auto j : box) {
				//cout << "loop " << i << " " << j << endl;
				if (v.front() < st)break;
				if (st > j)continue;
				vector<long long int>w;
				for (auto k : v) {
					if ((k&((1LL << i) - 1)) >= j) {
						w.push_back(k >> i);
					}
					else {
						w.push_back((k >> i) - 1);
					}
				}
				vector<long long int>dif;
				for (auto k : w)dif.push_back(k - w.front());
				long long int ed = j;
				long long int bit = 0;
				for (int k = 61; k >= 0; k--) {
					if (((st >> k) & 1)&((ed >> k) & 1))bit |= (1LL << k);
					else if (((st >> k) & 1) | ((ed >> k) & 1)) {
						if(st!=bit)bit |= (1LL << k);
						break;
					}
				}
				int used = 0;
				while (bit) {
					used += bit & 1;
					bit >>= 1;
				}
				if (!st)used = 0;
				st = j + 1;
				//cout << "used " << i + used << endl;
				if (i + used > K)continue;
				//cout << "loop " << i << " ";
				//cout << "bit " << j << endl;
				//cout << "diff ";
				//cout << w.front() << endl;
				//for (auto k : dif)cout << k << endl;
				R = w.front();
				L = max(R - (K - i - used), 0LL);
				if (mp[dif].empty()) {
					mp[dif].insert({ L,R });
				}
				else {
					auto it = mp[dif].lower_bound({ L,MOD*MOD });
					while (it != mp[dif].end() && it->first <= R + 1) {
						auto nx = next(it);
						R = max(R, it->second);
						mp[dif].erase(it);
						it = nx;
					}
					it = mp[dif].lower_bound({ L,MOD*MOD });
					if (it != mp[dif].begin()) {
						it = prev(it);
						while (it->second >= L - 1) {
							if (it == mp[dif].begin()) {
								L = min(L, it->first);
								R = max(R, it->second);
								mp[dif].erase(it);
								break;
							}
							auto pv = prev(it);
							L = min(L, it->first);
							R = max(R, it->second);
							mp[dif].erase(it);
							it = pv;
						}
					}
					mp[dif].insert({ L,R });
				}
				st = j + 1;
			}
		}
		long long int ans = 0;
		for (auto i : mp) {
			//cout << "vector\n";
			//for (auto j : i.first)cout << j << " ";
			//cout << endl;
			for (auto j : i.second) {
				//cout << j.first << " " << j.second << endl;
				ans += j.second - j.first + 1;
				ans %= MOD;
			}
		}
		cout << ans << endl;
	//}
	return 0;
}