#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long N = 2e5 + 5;
const long double pi = 3.14159265359;
long long n, k, x, bit, p, ans;
map<long long, long long> m;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  bit = (1LL << k) - 1;
  m[0] = 1;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    if (m[(p ^ x)] < m[(p ^ x ^ bit)]) {
      p ^= x;
    } else
      p ^= (x ^ bit);
    ans += (i + 1) - m[p];
    m[p]++;
  }
  cout << ans << "\n";
  return 0;
}
