#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  vector<long long> a(n);
  for (long long o = 0; o < n; o++) {
    cin >> a[o];
  }
  std::map<long long, long long> m;
  m[0] = 1ll;
  long long y = 0ll;
  long long res = (n * (n + 1ll)) / 2ll;
  for (long long i = 0; i < n; ++i) {
    y = y ^ a[i];
    if (m[y] > m[(1ll << k) - 1ll - y]) y = (1ll << k) - y - 1ll;
    res -= m[y];
    m[y]++;
  }
  cout << res;
}
