#include <bits/stdc++.h>
using namespace std;
long long n, k, X[200010], S[200010];
map<long long, long long> hsh;
signed main() {
  scanf("%lld%lld", &n, &k);
  long long tot = (1 << k) - 1;
  for (long long i = 1; i <= n; i++)
    scanf("%lld", &X[i]), S[i] = S[i - 1] ^ X[i];
  for (long long i = 0; i <= n; i++) hsh[min(S[i], tot - S[i])]++;
  long long ans = n * (n + 1) / 2;
  for (map<long long, long long>::iterator it = hsh.begin(); it != hsh.end();
       it++) {
    long long v = it->second;
    ans -= (v / 2) * (v / 2 - 1) / 2 + (v - v / 2) * (v - v / 2 - 1) / 2;
  }
  printf("%lld\n", ans);
  return 0;
}
