#include<bits/stdc++.h>
using namespace std;
long long a[1000001];
long long pref[100001];
int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long n, k;
    cin >> n >> k;
    long long ans = 0, f = -1, l = -1;
    pref[n] = -1;
    for(long long i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] != 0 && f == -1)f = i;
        if(a[i] != 0)l = i;
    }
    if(k != 1){
        for(long long i = 0; i < n; i++){
            long long anss = a[i];
            for(long long j = i; j < n; j++){
                anss = anss | a[j];
                if(anss >= k){
                    //cout << i << " " << j << " " << anss << " " << k << endl;
                    ans += n - j;
                    break;
                }
            }
        }
        cout << ans;
    }else{
        for(int i = n - 1; i >= 0; i--){
            if(a[i] != 0)pref[i] = i;
            else pref[i] = pref[i + 1];
        }
        for(int i = 0; i < n; i++){
            //cout << i << " " << pref[i] << endl;
            if(pref[i] != -1)ans += n - pref[i];
        }
        cout << ans;
    }

    return 0;
}
