#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  ll tot = 1ll * n * (n + 1) / 2;
  int mask = (1 << k) - 1;
  map<int, int> cnt;
  cnt[0]++;
  for (int i = 0, v = 0; i < n; ++i) {
    int x;
    cin >> x;
    auto y = ((~x) & mask);
    x ^= v;
    y ^= v;
    if (cnt[x] < cnt[y])
      tot -= cnt[x]++, v = x;
    else
      tot -= cnt[y]++, v = y;
  }
  cout << tot;
}
