#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n;
int a[1000010];
int l;
int x[32], y[32];
void foo(int k) {
  k--;
  int t = 0;
  int h;
  for (l = 0; k; l++) {
    x[l] = k;
    y[l] = ~t;
    h = k & (-k);
    k ^= h;
    t = h - 1;
  }
  x[l] = 0;
  y[l] = ~t;
  l++;
}
ll bar(int j) {
  ll i, i1, l, l1;
  int t1, t2;
  ll s1, s2;
  ll r = 0;
  if (x[j] != 0) {
    for (i = 0; i <= n;) {
      t1 = a[i] & y[j];
      t2 = t1 ^ x[j];
      i1 = lower_bound(a + i + 1, a + n + 1, t1 + (~y[j]) + 1) - a;
      if (t1 > t2) {
        l = lower_bound(a, a + n + 1, t2) - a;
        l1 = lower_bound(a, a + n + 1, t2 + (~y[j]) + 1) - a;
        r += (i1 - i) * (l1 - l);
      }
      i = i1;
    }
  } else {
    for (i = 0; i <= n;) {
      t1 = a[i] & y[j];
      i1 = lower_bound(a + i + 1, a + n + 1, t1 + (~y[j]) + 1) - a;
      r += (i1 - i) * (i1 - i - 1) / 2;
      i = i1;
    }
  }
  return r;
}
int main() {
  int i;
  int k;
  scanf("%lld %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i + 1]);
  }
  foo(k);
  a[0] = 0;
  for (i = 0; i < n; i++) {
    a[i + 1] ^= a[i];
  }
  sort(a, a + n + 1);
  ll r = 0;
  for (i = 0; i < l; i++) {
    r += bar(i);
  }
  printf("%lld\n", n * (n + 1) / 2 - r);
}
