#include <bits/stdc++.h>
using namespace std;
int n, k;
int arr[200000 + 10];
long long ans;
map<int, int> m;
long long comb(long long x) {
  if (x < 2) return 0;
  return x * (x - 1) / 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d%d", &n, &k);
  int t = (1 << k) - 1;
  ans = comb(n + 1);
  m[0]++;
  int i;
  for (i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    arr[i] = arr[i - 1] ^ x;
    if (arr[i] * 2 > t)
      m[t - arr[i]]++;
    else
      m[arr[i]]++;
  }
  map<int, int>::iterator it;
  for (it = m.begin(); it != m.end(); it++) {
    int x = it->second;
    ans -= comb(x / 2) + comb(x - x / 2);
  }
  printf("%lld", ans);
  return 0;
}
