#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[300000], b[300000];
map<int, long long> mm;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int k;
  cin >> n >> k;
  long long val = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = a[i - 1] ^ a[i];
    b[i] = (1 << k) - 1 - a[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long x = mm[a[i]], y = mm[b[i]];
    long long incx = x + (a[i] == 0), incy = y + (b[i] == 0);
    if (incx < incy) {
      mm[a[i]]++;
      if (a[i] == 0) ans++;
    } else {
      mm[b[i]]++;
      if (b[i] == 0) ans++;
    }
  }
  for (auto it = mm.begin(); it != mm.end(); it++) {
    ans += it->second * (it->second - 1) / 2LL;
  }
  ans = n * (n + 1) / 2 - ans;
  cout << ans << endl;
  return 0;
}
