#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<long long> a(n);
  map<long long, int> t;
  long long p = (1LL << k) - 1;
  long long ans = 0;
  t[0] = 1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (i) {
      a[i] ^= a[i - 1];
    }
    a[i] = min(a[i], a[i] ^ p);
    ++t[a[i]];
  }
  map<long long, int> cur;
  cur[0] = 1;
  for (int i = 0; i < n; ++i) {
    if (cur[a[i]] >= t[a[i]] / 2) {
      a[i] ^= p;
    }
    ++cur[a[i]];
  }
  map<long long, int> kek;
  kek[0] = 1;
  for (int i = 0; i < n; ++i) {
    ans += i + 1 - kek[a[i]];
    ++kek[a[i]];
  }
  cout << ans;
  return 0;
}
