#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 50, INF = 0, MOD = 0;
long long n, k, a[N], par[N];
map<long long, long long> m;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  long long ans = 1ll * (n + 1) * n / 2;
  long long W = (1 << k) - 1;
  for (long long i = 0; i < n; i++) cin >> a[i];
  m[0]++;
  par[0] = a[0];
  m[par[0]]++;
  if (a[0] == 0) {
    m[par[0]]--;
    par[0] = W;
    m[par[0]]++;
  }
  for (long long i = 1; i < n; i++) {
    long long tmp = par[i - 1] ^ a[i];
    long long tmp2 = par[i - 1] ^ (a[i] ^ W);
    if (m[tmp] <= m[tmp2]) {
      par[i] = tmp;
      ans -= m[tmp];
      m[par[i]]++;
    } else {
      par[i] = tmp2;
      ans -= m[tmp2];
      m[par[i]]++;
    }
  }
  cout << ans << '\n';
  return 0;
}
