Problem:
Score : 1200 points

Problem Statement

There are N non-negative integers written on the blackboard: A_1, ..., A_N.

Snuke can perform the following two operations at most K times in total in any order:

Operation A: Replace each integer X on the blackboard with X divided by 2, rounded down to the nearest integer.

Operation B: Replace each integer X on the blackboard with X minus 1. This operation cannot be performed if one or more 0s are written on the blackboard.

Find the number of the different possible combinations of integers written on the blackboard after Snuke performs the operations, modulo 1,000,000,007.

Constraints

1 \leq N \leq 200

1 \leq A_i \leq 10^{18}

1 \leq K \leq 10^{18}

A_i and K are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 ... A_N

Output

Print the number of the different possible combinations of integers written on the blackboard after Snuke performs the operations, modulo 1,000,000,007.

Sample Input 1

2 2
5 7

Sample Output 1

6

There are six possible combinations of integers on the blackboard: (1, 1), (1, 2), (2, 3), (3, 5), (4, 6) and (5, 7).
For example, (1, 2) can be obtained by performing Operation A and Operation B in this order.

Sample Input 2

3 4
10 13 22

Sample Output 2

20

Sample Input 3

1 100
10

Sample Output 3

11

Sample Input 4

10 123456789012345678
228344079825412349 478465001534875275 398048921164061989 329102208281783917 779698519704384319 617456682030809556 561259383338846380 254083246422083141 458181156833851984 502254767369499613

Sample Output 4

164286011

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 205;
const int   mod = 1e9 + 7;

typedef pair<ll,ll> pll;

ll  a[N];
ll  b[N];

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n;  cin >> n;
    ll  K;  cin >> K;

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

    for(int i = 0 ; i <  n ; ++i)   cin >> a[i];    sort(a,a + n);
    for(int t = 0 ; t < 60 ; ++t)   {
        vector<ll>  vec;

        for(int i = 0 ; i < n ; ++i)
            vec.pb(a[i] & ((1ll << t) - 1));

        sort(all(vec));
        vec.erase(unique(all(vec)),vec.end());

        ll  lst = -1;

        for(ll  x : vec)    {
            if (x > a[0])   break;

            for(int i = 0 ; i < n ; ++i)    b[i] = (a[i] - x) >> t;
            for(int i = 1 ; i < n ; ++i)    assert(b[i] >= b[i - 1]);

            ll  cnt = t;
            if (lst >= 0)   {
                for(int b = 59 ; b >= 0 ; --b)  {
                    int u = (lst >> b & 1);
                    int v = (x   >> b & 1);

                    if (v)  cnt++;
                    if (u != v)
                        break;
                }
            }
            lst = x;

            if (K < cnt)
                continue;

            vector<ll>  d;
            for(int i = 1 ; i < n ; ++i)
                d.pb(b[i] - b[i - 1]);
            
            mp[d].pb(pll(b[0] - K + cnt,b[0]));
        }
    }
    ll  ans = 0;
    
    for(auto&it : mp)   {
        vector<pll>&vec = it.Y;
        sort(all(vec));

        ll  L = 0;
        ll  R = -1;

        for(pll T : vec)    {
            if (R < T.X)    {
                ans += R - L + 1;
                ans %= mod;
                L = T.X;
            }
            R = max(R,T.Y);
        }
        ans += R - L + 1;
        ans %= mod;

/*        for(pll T : it.Y)
            swp[T.X]++,
            swp[T.Y + 1]--;
        
        ll  lst = 0;
        int Sum = 0;

        for(auto it : swp)  {
            if (Sum)    {
                ans += it.X - lst;
                ans %= mod;
            }
            Sum += it.Y;
            lst  = it.X;
        }*/
    }
    cout << ans<< endl;
}