#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long double PI = 4 * atan(1);
int n, k, t, dp[200001], cum, c;
vector<int> v;
map<int, int> m;
int calc(int ind, int x) {
  int i = m[x];
  if (i > 0) {
    return dp[i] + (ind - i - 1);
  } else {
    if (x == 0) {
      return ind - 1;
    } else {
      return ind;
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> k;
  cum = 0, c = (int)(1 << k) - 1;
  for (int i = 1; i < n + 1; i++) {
    cin >> t;
    cum ^= t;
    int x = calc(i, cum), y = calc(i, cum ^ c);
    if (y > x) {
      cum ^= c;
      m[cum] = i;
      dp[i] = y;
    } else {
      m[cum] = i;
      dp[i] = x;
    }
  }
  long long ans = 0;
  for (int i = 1; i < n + 1; i++) ans += dp[i];
  cout << ans;
  return 0;
}
