#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
unordered_map<int, int> mp;
int n, k, a[200500];
long long ans = 0;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) a[i] = a[i] ^ a[i - 1];
  mp[0] = 1;
  int all = (1 << k) - 1;
  for (int i = 1; i <= n; i++) {
    int x = mp.count(a[i]) ? mp[a[i]] : 0;
    int y = mp[all ^ a[i]] ? mp[all - a[i]] : 0;
    if (x <= y) {
      ans += x, mp[a[i]]++;
    } else {
      ans += y, mp[all ^ a[i]]++;
    }
  }
  cout << 1ll * n * (n + 1) / 2 - ans << endl;
  return 0;
}
