#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167772160000")
template <typename T>
using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T>
using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;
const long double PI = asin(1) * 2;
using namespace std;
int arr[200000];
map<int, int> cnt;
int full;
int negat(int x) { return (~x) & full; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  full = (1 << k) - 1;
  int curr = 0;
  cnt[curr]++;
  long long best = 0;
  for (int i = (0); i < (n); i++) {
    cin >> arr[i];
    long long noNeg = i + 1 - cnt[curr ^ arr[i]];
    long long neg = i + 1 - cnt[curr ^ negat(arr[i])];
    if (noNeg >= neg) {
      curr ^= arr[i];
    } else {
      curr ^= negat(arr[i]);
    }
    cnt[curr]++;
    best += max(noNeg, neg);
  }
  cout << best << endl;
  return 0;
}
