#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int n, m;
long long a[maxn];
int main() {
  scanf("%d%d", &n, &m);
  long long b = 1LL << (m - 1), r = (1LL << m) - 1;
  for (int i = 0; i < n; i++) {
    scanf("%lld", a + i);
    if (a[i] >= b) a[i] ^= r;
    if (i) a[i] ^= a[i - 1];
  }
  a[n++] = 0;
  sort(a, a + n);
  long long ans = 1LL * n * (n - 1) / 2;
  for (int i = 0; i < n;) {
    int j = i + 1;
    for (; j < n && a[j] == a[i]; j++)
      ;
    long long k = (j - i) / 2;
    ans -= k * (k - 1) / 2;
    k = (j - i + 1) / 2;
    ans -= k * (k - 1) / 2;
    i = j;
  }
  printf("%lld\n", ans);
  return 0;
}
