#include <bits/stdc++.h>
//#define D
using namespace std;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> o; int tmp;
    int zt = 0; /// zeros total
    int zs = 0; /// zeros streak
    for(int i = 0; i < n; i++){
        cin >> tmp;
        if(k==1){
            if(tmp == 0){zs++;}
            else if(zs > 0){
                zt += zs+(zs*(zs-1))/2;
                zs = 0;
            }
        }
        o.push_back(tmp);
    }
    if(k==1){
        if(zs > 0){
            zt += zs+(zs*(zs-1))/2;
            zs = 0;
        }
    }
    if(k == 1){cout << n+(n*(n-1))/2 - zt; return 0;}
    unsigned long long sum = 0;
    int a;
    for(int i = 0; i < n; i++){
        //cout << i << ": " << o[i] << '\n';
        a = o[i];
        if(a >= k){sum += n-i; continue;}
        for(int j = i+1; j < n; j++){
            //cout << '\t' << j << ": " << o[j] << '\n';
            a |= o[j];
            if(a >= k){
                sum += n-j;
                //cout << "\t\t" << n-j << '\n';
                break;
            }
        }
    }
    cout << sum;
    return 0;
}
