#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> mymap, mymap1;
long long int cum[200010], a[200010];
int main() {
  long long int n, i, j, k;
  scanf("%lld", &n);
  ;
  scanf("%lld", &k);
  ;
  cum[0] = 0;
  mymap[0]++;
  for (i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    ;
    cum[i] = cum[i - 1] ^ a[i];
    long long int temp1 = cum[i], temp2 = ((1 << k) - 1) ^ temp1;
    if (mymap[temp1] == 0)
      mymap[temp2]++;
    else
      mymap[temp1]++;
  }
  long long int ans = (n * (n + 1)) / 2;
  map<long long int, long long int>::iterator it;
  long long int subt = 0;
  for (it = mymap.begin(); it != mymap.end(); it++) {
    long long int val = it->first, freq = it->second;
    long long int temp = freq / 2;
    subt += ((temp * (temp - 1)) / 2);
    temp = freq - temp;
    subt += ((temp * (temp - 1)) / 2);
  }
  cout << ans - subt << endl;
  return 0;
}
