#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
mt19937 rnd(time(0));
const long long maxn = 3e5 + 7, mod = 1e9 + 7, inf = 1e18;
const double eps = 1e-9, pi = acos(-1);
long long n, k;
long long a[maxn];
map<long long, long long> have;
void solve() {
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long msk = 0;
  have[msk] = 1;
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    long long msk1 = msk;
    long long msk2 = msk;
    for (long long bt = 0; bt < k; ++bt) {
      if ((a[i] >> bt) & 1)
        msk1 ^= (1 << bt);
      else
        msk2 ^= (1 << bt);
    }
    long long can1 = 0;
    long long can2 = 0;
    for (long long bt = 0; bt < k; ++bt) {
      if ((msk1 >> bt) & 1) can1 += (1 << bt);
      if ((msk2 >> bt) & 1) can2 += (1 << bt);
    }
    long long d1 = i + 1;
    long long d2 = i + 1;
    if (have.count(can1)) d1 -= have[can1];
    if (have.count(can2)) d2 -= have[can2];
    ans += max(d1, d2);
    if (d1 > d2)
      msk = msk1;
    else
      msk = msk2;
    if (have.count(msk) == 0) have[msk] = 0;
    have[msk]++;
  }
  cout << ans;
}
signed main() {
  srand(time(0));
  cout.precision(4);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
