#include <bits/stdc++.h>
using namespace std;
long long n, m, T, k, d;
const long long big = 1000000007;
vector<long long> A;
unordered_map<long long, long long> M;
set<long long> S;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long a, b, c, d, e;
  cin >> n >> k;
  long long ones = (1 << k) - 1;
  long long xo = 0;
  M[xo] = 1;
  A.push_back(0);
  for (int c1 = 0; c1 < n; c1++) {
    cin >> a;
    xo ^= a;
    if (M.find(xo) == M.end()) {
      M[xo] = 0;
    }
    M[xo]++;
    A.push_back(xo);
  }
  long long ans = 0;
  for (int c1 = 0; c1 < n + 1; c1++) {
    a = A[c1];
    if (S.find(a) == S.end()) {
      long long sum = M[a];
      b = (ones ^ a);
      if (M.find(b) != M.end()) {
        sum += M[b];
      }
      S.insert(a);
      S.insert(b);
      long long d1 = sum / 2;
      long long d2 = sum / 2 + sum % 2;
      ans += (d1 * (d1 - 1)) / 2;
      ans += (d2 * (d2 - 1)) / 2;
    }
  }
  ans = (n * (n + 1)) / 2 - ans;
  cout << ans << "\n";
  return 0;
}
