#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
long long n, k, a[200050], b[200050];
long long ans, maxp;
int main() {
  scanf("%d%d", &n, &k);
  maxp = (1 << k) - 1;
  for (int i(1); i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = b[i - 1] ^ a[i];
  }
  ans = (n + 1) * n / 2;
  m[0]++;
  for (int i(1); i <= n; i++) {
    long long ai = a[i];
    long long c1 = b[i], c2 = (maxp - b[i]);
    if (m[c1] > m[c2]) {
      ans -= m[c2];
      m[c2]++;
    } else {
      ans -= m[c1];
      m[c1]++;
    }
  }
  printf("%lld", ans);
  return 0;
}
