#include <bits/stdc++.h>

#define MAXN 100005

using namespace std;

int n, k;
int a[MAXN];
vector<int> bits[32];

void add(int x, int idx) {
    for (int i = 0; i <= 31; i++) {
        if (x % 2 == 1) bits[i].push_back(idx);
        x = x / 2;
    }
}

vector<bool> get_bits(int x) {
    vector<bool> b(32, 0);

    for (int i = 0; i <= 31; i++) {
        b[i] = x % 2;
        x = x / 2;
    }

    return b;
}

int binarySearch(int bit_idx, int idx) {
    int l = 0, r = bits[bit_idx].size() - 1;

    while (l <= r) {
        int m = (l + r) / 2;

        if (bits[bit_idx][m] >= idx) r = m - 1;
        else l = m + 1;
    }

    if (l == bits[bit_idx].size()) return -1;
    return bits[bit_idx][l];
}

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

    cin >> n >> k;

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        add(a[i], i);
    }

    long long ans = 0;

    vector<bool> k_bits = get_bits(k); //reverse(k_bits.begin(), k_bits.end());

    //for (int i = 0; i <= 31; i++) cout << k_bits[i]; cout << endl;

    for (int i = 1; i <= n; i++) {
        if (a[i] >= k) {
            //cout << i << " " << "continued" << endl;
            ans = ans + (n - i + 1);
            continue;
        }

        vector<bool> b = get_bits(a[i]); //reverse(b.begin(), b.end());
        bool flag = false;
        int min_start = 0;

        //for (bool element: b) cout << element; cout << endl;

        for (int j = 0; j <= 5; j++) {
            //cout << b[j] << " " << k_bits[j] << endl;
            if (b[j] >= k_bits[j]) continue;

            int res = binarySearch(j, i);

            //cout << b[j] << " " << k_bits[j] << " " << j << " result = " << res << endl;

            if (res == -1) {
                flag = true;
                break;
            }

            min_start = max(min_start, res);
        }

        if (flag) continue;
        ///cout << i << " " << min_start << endl;
        //cout << "--------" << endl;

        ans = ans + (n - min_start + 1);
    }

    cout << ans << endl;

    return 0;
}
