#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mmp;
long long pre = 0;
long long n, k, Mx;
long long ans = 0;
signed main() {
  cin >> n >> k;
  Mx = (1 << k) - 1;
  ans = n * (long long)(n + 1) / 2;
  mmp[0] = 1;
  for (long long i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    long long A = pre ^ x;
    long long B = A ^ Mx;
    if (mmp[A] <= mmp[B]) {
      ans -= mmp[A];
      pre = A;
      mmp[A]++;
    } else {
      ans -= mmp[B];
      pre = B;
      mmp[B]++;
    }
  }
  cout << ans;
}
