#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long int n, k;
  cin >> n >> k;
  map<long long int, long long int> cnt;
  long long int x = 0;
  cnt[x]++;
  k = (1 << k) - 1;
  long long int ans = n * (n + 1) / 2;
  for (long long int i = 0; i < n; i++) {
    long long int val;
    cin >> val;
    x ^= val;
    if (cnt[x] > cnt[x ^ k])
      cnt[x ^ k]++;
    else
      cnt[x]++;
  }
  for (auto &it : cnt) {
    ans -= (it.second * (it.second - 1)) / 2;
  }
  cout << ans;
  return 0;
}
