#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const unsigned gen_seed =
    std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937_64 gen(gen_seed);
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int bar = 1 << (k - 1);
  int xr = (1 << k) - 1;
  map<int, int> num;
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int tot = 0;
  num[tot]++;
  for (auto x : a) {
    tot ^= x;
    if (tot < bar)
      num[tot]++;
    else
      num[xr ^ tot]++;
  }
  long long nl = n;
  long long ans = nl * (nl + 1) / 2;
  for (auto x : num) {
    long long n1 = x.second / 2;
    long long n2 = x.second - n1;
    ans -= n1 * (n1 - 1) / 2;
    ans -= n2 * (n2 - 1) / 2;
  }
  cout << ans;
}
