#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<int> xors(n + 1);
  xors[0] = 0;
  for (int i = 0; i < n; i++) xors[i + 1] = xors[i] ^ x[i];
  map<int, int> y;
  for (int i = 0; i < xors.size(); i++) {
    if (y.find(xors[i]) == y.end())
      y[xors[i]] = 1;
    else
      y[xors[i]]++;
  }
  int important = (1 << k) - 1;
  set<int> z;
  long long answer = 0;
  for (auto a : y) {
    if (z.find(a.first) == z.end()) {
      int b = a.first ^ important;
      long long c = a.second;
      z.insert(a.first);
      if (y.find(b) != y.end()) {
        c += y[b];
        z.insert(b);
      }
      long long d = c / 2, e = c - c / 2;
      answer += d * (d - 1) / 2 + e * (e - 1) / 2;
    }
  }
  cout << (long long)n * (n + 1) / 2 - answer << endl;
}
