#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
int n, k;
int a[200007];
long long ans;
map<int, long long> mp;
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int r = 0, m = (1 << k) - 1;
  mp[0] = 1;
  for (int i = 1; i <= n; i++) {
    r = r ^ a[i];
    int t = r ^ m;
    if (mp[r] < mp[t])
      ans += mp[r], mp[r]++;
    else
      ans += mp[t], mp[t]++;
  }
  ans = (1 + n) * 1ll * n / 2 - ans;
  cout << ans;
  return 0;
}
