#include <bits/stdc++.h>
using namespace std;
long long n, k, A[207171];
map<long long, long long> F;
long long numar(long long a) { return a * (a - 1) / 2; }
signed main() {
  cin >> n >> k;
  ++F[0];
  long long inv = (1 << k) - 1;
  for (long long i = 1; i <= n; ++i) {
    cin >> A[i];
    A[i] = A[i - 1] ^ min(A[i], A[i] ^ inv);
    F[A[i]]++;
  }
  long long re = 0;
  long long ac = 0;
  for (auto it : F) {
    ac = it.second;
    re += numar(ac / 2);
    re += numar((ac + 1) / 2);
  }
  cout << numar(n + 1) - re << "\n";
  return 0;
}
