#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 9;
const long long int MOD = 1e9 + 696969;
const long long INF = 1e18 + 3;
const int maxn = 1001000;
map<int, int> ILE;
int pref[maxn], n, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  int clue = (1 << k) - 1;
  ILE[0] = 1;
  long long int result = 0;
  for (int i = (1); i <= (n); ++i) {
    int a;
    cin >> a;
    pref[i] = (pref[i - 1] ^ a);
    a = pref[i];
    if (ILE[a] > ILE[a ^ clue]) a ^= clue, pref[i] ^= clue;
    result += i - ILE[a];
    ILE[a]++;
  }
  cout << result;
}
