#include <bits/stdc++.h>
using namespace std;
long long int em(long long int x, long long int Mod, long long int n) {
  if (n == 0)
    return 1ll;
  else if (n % 2 == 0)
    return em((x % Mod * x % Mod) % Mod, Mod, n / 2) % Mod;
  else
    return (x % Mod * em((x % Mod * x % Mod) % Mod, Mod, (n - 1) / 2)) % Mod;
}
long long int arr[200002];
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, i, j, l;
  cin >> n >> k;
  for (long long int i = (long long int)1; i < (long long int)n + 1; i++) {
    cin >> arr[i];
    arr[i] ^= arr[i - 1];
  }
  map<long long int, long long int> ma;
  long long int comp = (1ll << k) - 1;
  ma[0]++;
  for (long long int i = (long long int)1; i < (long long int)n + 1; i++)
    ma[min(arr[i], arr[i] ^ comp)]++;
  long long int ans = (n * (n + 1)) / 2;
  for (pair<long long int, long long int> y : ma) {
    long long int u = (y.second) / 2;
    ans -= (u * (u - 1)) / 2;
    u = y.second - u;
    ans -= (u * (u - 1)) / 2;
  }
  cout << ans;
}
