#include<bits/stdc++.h>
using namespace std;
long long a[500000];
vector<long long> dv(long long a){
    vector<long long> v;
    while(a>0){
        v.push_back(a%2);
        a=a/2;
    }
    reverse(v.begin(),v.end());
    return v;

}
vector<long long> sb(vector<long long> a,vector <long long> b){
    vector<long long> c;
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    long long l=min(a.size(),b.size());
    for(long long i=0;i<l;i++){
        c.push_back(max(a[i],b[i]));
    }
    if(a.size()==b.size()){
        return c;
    }
    if(a.size()>b.size()){
        for(long long i=b.size();i<a.size();i++){
        c.push_back(a[i]);
        }
    }
    if(a.size()<b.size()){
        for(long long i=a.size();i<b.size();i++){
        c.push_back(b[i]);
        }
    }
    reverse(c.begin(),c.end());
    return c;
}
bool cmp(vector<long long> a,vector<long long> b){
    if(a.size()>b.size()){
        return true;
    }
    long long sa=a.size();
    long long sb=b.size();
    if(sa==sb){
        for(long long i=0;i<a.size();i++){
            if(b[i]>a[i]){
                return false;
            }
        }
        return true;
    }
    return false;
}
int main(){
    long long n,k;
    cin>>n>>k;
    vector <long long> vk=dv(k);
    for(long long i=0;i<n;i++){
        cin>>a[i];
    }
    long long otg=0;
    vector<long long> tek,ok;
    for(long long i=0;i<n;i++){
        long long i2=i;
        tek.clear();
        ok.clear();
        while(cmp(tek,vk)==false){
            if(i2==n){
                i2++;
                break;
            }
            ok=sb(tek,dv(a[i2]));
            i2++;
            tek.clear();
            tek=ok;
            ok.clear();

        }
        i2--;
        ///cout<<i<<" "<<i2<<endl;
        otg+=(n-i2);
    }
    cout<<otg<<endl;



return 0;
}
