#include <bits/stdc++.h>
const int N = 2e5 + 7;
using namespace std;
long long n, k, lim, a[N];
map<long long, long long> M;
long long C(long long x) { return x * (x - 1LL) >> 1LL; }
int main() {
  scanf("%lld%lld", &n, &k);
  lim = (1ll << k) - 1ll;
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  for (int i = 2; i <= n; ++i) a[i] ^= a[i - 1];
  for (int i = 1; i <= n; ++i) a[i] = min(a[i], lim - a[i]), ++M[a[i]];
  ++M[0];
  long long ans = C(n) + n;
  for (map<long long, long long>::iterator it = M.begin(); it != M.end();
       ++it) {
    long long w = (*it).second, a;
    a = w / 2LL;
    ans -= C(a) + C(w - a);
  }
  printf("%lld\n", ans);
  return 0;
}
