#include <bits/stdc++.h>
using namespace std;
long long s[200030];
inline int My_abs(int x) { return x < 0 ? -x : x; }
int main() {
  long long n, k;
  long long i, j;
  long long cnt, ans, tmp;
  long long x;
  long long MAX;
  cin >> n >> k;
  MAX = (1 << (long long)k) - 1;
  s[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> x;
    s[i] = s[i - 1] ^ x;
  }
  for (i = 0; i <= n; i++) s[i] = min(s[i], MAX ^ s[i]);
  sort(s, s + n + 1);
  cnt = 0;
  ans = (n + 1) * n / 2;
  for (i = 0; i <= n; i++) {
    if (i == 0 || s[i] == s[i - 1])
      cnt++;
    else {
      if (cnt % 2) {
        tmp = cnt / 2;
        ans -= tmp * (tmp - 1) / 2;
        tmp = cnt / 2 + 1;
        ans -= tmp * (tmp - 1) / 2;
      } else {
        tmp = cnt / 2;
        ans -= tmp * (tmp - 1);
      }
      cnt = 1;
    }
  }
  if (cnt % 2) {
    tmp = cnt / 2;
    ans -= tmp * (tmp - 1) / 2;
    tmp = cnt / 2 + 1;
    ans -= tmp * (tmp - 1) / 2;
  } else {
    tmp = cnt / 2;
    ans -= tmp * (tmp - 1);
  }
  cout << ans;
  return 0;
}
