#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007, mxn = 1000010;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k, i, j, c, a, b, x, d = 0, d2 = 0, w1 = 0, w2 = 0;
  cin >> n >> k;
  x = (1 << k) - 1;
  map<int, int> mapp;
  mapp[0]++;
  long long wyn = (long long)n * (n + 1) / 2;
  int wst = 0, ter;
  for (i = 0; i < n; i++) {
    cin >> ter;
    a = ter;
    w1 = mapp[ter ^ wst];
    w2 = mapp[ter ^ wst ^ x];
    wyn -= (long long)min(w1, w2);
    if (w1 > w2) {
      a ^= x;
    }
    mapp[(a ^ wst)]++;
    wst ^= a;
  }
  cout << wyn;
}
