#include <bits/stdc++.h>
using namespace std;
int s[1000050];
map<int, int> mp;
int main() {
  int n, k, i, x, dt, all;
  long long ans;
  scanf("%d%d", &n, &k);
  all = (1 << k) - 1;
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    s[i] = s[i - 1] ^ x;
  }
  mp.clear();
  mp[0]++;
  ans = dt = 0;
  for (i = 1; i <= n; i++) {
    if (mp[s[i] ^ all ^ dt] < mp[s[i] ^ dt]) dt ^= all;
    ans += mp[s[i] ^ dt], mp[s[i] ^ dt]++;
  }
  printf("%lld\n", 1ll * n * (n + 1) / 2 - ans);
  return 0;
}
