#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INF64 = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-8;
const int MOD = 1000000007;
const int N = 2e6 + 10;
const int M = 1e5 + 10;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int mask = (1 << k) - 1;
  map<int, int> mp;
  mp[0] = 1;
  long long ans = 0;
  int p = 0;
  for (auto &i : a) {
    cin >> i;
    p ^= i;
    int &v1 = mp[p], &v2 = mp[p ^ mask];
    if (v1 < v2) {
      ans += v1;
      ++v1;
    } else {
      ans += v2;
      ++v2;
    }
  }
  cout << (long long)n * (n + 1) / 2 - ans << '\n';
  return 0;
}
