#include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 1000 + 20;
int a[N], ps[N];
map<long long int, long long int> mp;
map<long long int, long long int>::iterator it;
int main() {
  long long int n, k;
  long long int mines = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ps[0] = a[0];
  mp[0] = 1;
  mp[ps[0]]++;
  for (int i = 1; i < n; i++) {
    ps[i] = ps[i - 1] ^ a[i];
    mp[ps[i]]++;
  }
  for (it = mp.begin(); it != mp.end(); it++) {
    int i = it->second, j = it->first;
    int s = i + mp[(1 << k) - j - 1];
    if (s % 2 == 0) {
      long long int t = s / 2;
      mines += t * (t - 1);
      it->second = 0;
      mp[(1 << k) - j - 1] = 0;
    } else {
      long long int t = s / 2;
      mines += (t * (t - 1)) / 2;
      mines += ((t + 1) * t) / 2;
      it->second = 0;
      mp[(1 << k) - j - 1] = 0;
    }
  }
  long long int all = (n * (n + 1)) / 2;
  cout << all - mines << "\n";
}
