#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 9;
long long a[N], ans;
unordered_map<long long, long long> mp;
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long tmp = (1ll << k) - 1;
  for (long long i = (long long)(1); i <= (long long)(n); i++) cin >> a[i];
  mp[0] = 1;
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    a[i] ^= a[i - 1];
    if (mp[a[i] ^ tmp] < mp[a[i]]) a[i] ^= tmp;
    ans += mp[a[i]];
    mp[a[i]]++;
  }
  cout << n * (n + 1) / 2 - ans;
}
