#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const double pi = acos(-1.0), eps = 1e-9;
const int N = 2e5 + 111, inf = 1e9, mod = 1e9 + 7;
int n, k, ob, a[N], b[N];
map<int, int> cnt;
map<int, bool> used;
long long ans;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  ob = (1 << k) - 1;
  cnt[0]++;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    b[i] = (b[i - 1] ^ a[i]);
    cnt[b[i]]++;
  }
  for (auto i : cnt) {
    if (used.count(i.first)) continue;
    long long x = i.second;
    if (cnt.count((i.first ^ ob)))
      x += cnt[(i.first ^ ob)], used[(i.first ^ ob)] = 1;
    long long y = x / 2, z = x - y;
    ans += y * (y - 1) / 2;
    ans += z * (z - 1) / 2;
  }
  cout << (1LL * n * (n + 1)) / 2 - ans;
  return 0;
}
