#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int a[n + 1];
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  long long int xr[n + 1];
  xr[0] = 0;
  map<long long int, long long int> m;
  m[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    xr[i] = xr[i - 1] xor a[i];
    xr[i] = min(xr[i], (1ll << k) - xr[i] - 1);
    m[xr[i]]++;
  }
  long long int ans = 0;
  for (auto i : m) {
    long long int x = i.second / 2;
    long long int y = (i.second + 1) / 2;
    ans = ans + (x * (x - 1)) / 2;
    ans = ans + (y * (y - 1)) / 2;
  }
  ans = ((n * (n - 1)) / 2) - ans;
  ans += n;
  cout << ans << endl;
}
