#include <bits/stdc++.h>
using namespace std;
const long long N = 11111111;
const long long INF = (long long)(1e12);
const long long mod = 998244353;
const double eps = 1e-9;
long long n, mx = -1, inv[N], a[N], k, all, cnt, ans;
map<long long, long long, greater<long long> > M, S;
long long get(long long x) { return (x) * (x + 1) / 2; }
int main() {
  ios_base ::sync_with_stdio(false);
  cin >> n >> k;
  all = (1ll << k) - 1;
  ans = get(n);
  M[0]++;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] ^= a[i - 1];
    inv[i] = (all ^ a[i]);
    if (M[a[i]] < M[inv[i]]) {
      ans -= M[a[i]];
      M[a[i]]++;
    } else {
      ans -= M[inv[i]];
      M[inv[i]]++;
    }
  }
  cout << ans;
  return 0;
}
