#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
long long a[N];
map<long long, long long> mp;
signed main() {
  long long n, k, lst = 0, ans = 0;
  scanf("%lld%lld", &n, &k);
  long long mov = (1 << k) - 1;
  mp[0] = 1;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    long long qwq = lst ^ a[i];
    long long qaq = qwq ^ mov;
    if (mp[qwq] < mp[qaq]) {
      ans += (mp[qwq]++);
      lst = qwq;
    } else {
      ans += (mp[qaq]++);
      lst = qaq;
    }
  }
  printf("%lld", n * (n + 1) / 2 - ans);
  return 0;
}
