#include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
long long a[N], c[N], ans, now, mx, t, la, n, m;
map<long long, long long> b, d;
signed main() {
  scanf("%lld%lld", &n, &m);
  mx = 1 << m;
  mx--;
  b[0] = 1;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &t);
    a[i] = a[i - 1] ^ t;
    if (a[i] >= (mx + 1) / 2)
      now = mx - a[i];
    else
      now = a[i];
    if (a[i] >= (mx + 1) / 2)
      b[mx - a[i]]++;
    else
      b[a[i]]++;
    if (b[now] & 1)
      c[i] = now;
    else
      c[i] = mx - now;
  }
  d[0] = 1;
  for (long long i = 1; i <= n; i++) {
    ans += i - d[c[i]];
    d[c[i]]++;
  }
  printf("%lld", ans);
}
