#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O2")
const int lim = 2e5 + 5;
long long n, k, x, y, t, ans, p[lim];
map<long long, long long> f;
long long inv(long long x) { return (~x) & ((1LL << k) - 1); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  f[0] += 1;
  ans += n * (n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> x;
    p[i] = p[i - 1] ^ x;
    f[p[i]]++;
  }
  for (auto u : f) {
    if (f.find(inv(u.first)) == f.end()) {
      t = f[u.first] / 2;
      y = f[u.first] - t;
      ans -= t * (t - 1) + y * (y - 1);
    } else {
      t = (f[u.first] + f[inv(u.first)]) / 2;
      y = f[u.first] + f[inv(u.first)] - t;
      ans -= t * (t - 1) / 2 + y * (y - 1) / 2;
    }
  }
  ans /= 2;
  cout << ans << endl;
  return 0;
}
