#include <bits/stdc++.h>
using namespace std;
int n, k;
const int N = 4e5;
int a[N], f[N];
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    f[i] = f[i - 1] ^ a[i];
  }
  int t = 0;
  int all = (1 << k) - 1;
  mp[f[0]]++;
  long long ans = 0;
  int cur = 0;
  for (int i = 1; i <= n; i++) {
    if (mp[f[i] ^ cur] < mp[all ^ f[i] ^ cur])
      ans += mp[f[i] ^ cur];
    else {
      ans += mp[all ^ f[i] ^ cur];
      cur ^= all;
    }
    mp[f[i] ^ cur]++;
  }
  cout << 1ll * (n + 1) * n / 2 - ans;
  return 0;
}
