#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1e9 + 7;
long long int INF = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k = 0, l = 0, r = 0, m = 0, n, x, y, z, a, b, c, p = 0,
                      cnt = 0, cnt1 = 0, low, mid, high, ans = 0, maxi = -1,
                      mini = INF, t, q;
  cin >> n >> k;
  map<long long int, long long int> ma;
  a = 0;
  pair<long long int, long long int> it;
  int A[n];
  ans = (n * (n + 1)) / 2;
  ma[0] = 1;
  for (i = 0; i < n; i++) {
    cin >> A[i];
    a ^= min(A[i], ((1 << k) - 1) - A[i]);
    ma[a]++;
  }
  for (auto it : ma) {
    l = it.second / 2;
    m = (it.second + 1) / 2;
    ans = ans - max(cnt, (l * (l - 1)) / 2) - max(cnt, (m * (m - 1)) / 2);
  }
  cout << ans << endl;
}
