#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, k;
ll conj(ll x) { return (~x) & ((1 << k) - 1); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  ll total = n * (n + 1) / 2ll;
  map<ll, ll> ap;
  ap[0] += 1;
  for (ll i = 0, curr = 0; i < n; ++i) {
    ll x;
    cin >> x;
    curr ^= x;
    if (ap[curr] > ap[conj(curr)]) curr = conj(curr);
    total -= ap[curr];
    ++ap[curr];
  }
  cout << total << endl;
  return 0;
}
