#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, Mod = 1e9 + 7;
int n, m, k, A[N], P[N];
map<int, int> M;
long long tot;
int main() {
  scanf("%d%d", &n, &k);
  m = (1 << k) - 1;
  for (int i = 1; i <= n; i++)
    scanf("%d", &A[i]), P[i] = P[i - 1] ^ A[i], M[min(P[i], m - P[i])]++;
  M[0]++;
  for (auto X : M) {
    int a = X.second >> 1;
    int b = X.second - a;
    tot += 1ll * a * (a - 1) / 2;
    tot += 1ll * b * (b - 1) / 2;
  }
  tot = 1ll * (n + 1) * n / 2 - tot;
  printf("%lld", tot);
  return (0);
}
