#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> arr(n);
  for (auto &i : arr) cin >> i;
  long long curr = 0, ans = n * (n - 1) / 2 + n, mx = (1 << k) - 1;
  unordered_map<long long, long long> st = {{0, 1}};
  for (auto i : arr) {
    curr ^= i;
    if (st[curr] > st[curr ^ mx]) curr ^= mx;
    ans -= st[curr];
    st[curr]++;
  }
  cout << ans;
  return 0;
}
