#include <bits/stdc++.h>
using namespace std;
int n, k;
map<int, int> cnt;
int a[200005];
signed main() {
  scanf("%d%d", &n, &k);
  int cur = 0;
  cnt[0] = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] = min(a[i], ((1 << k) - 1) - a[i]);
    cur ^= a[i];
    cnt[cur]++;
  }
  long long res = 0;
  for (auto i : cnt) {
    int x, y;
    x = i.second / 2;
    y = (i.second + 1) / 2;
    res += 1ll * x * (x - 1) + 1ll * y * (y - 1);
  }
  res = 1ll * n * (n + 1) - res;
  cout << res / 2;
}
