#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
const long long maxn = (long long)1e6 + 5;
const long long mod = (long long)1e9 + 7;
const long long inf = 0x3f3f3f3f3f3f3f3f;
unordered_map<long long, long long> num;
long long a[maxn];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  k = (1 << k) - 1;
  long long ans = (n + 1) * n / 2;
  num[0] = 1;
  long long x = 0, y = 0, tmp = 0;
  for (long long i = 1; i <= n; ++i) {
    x = tmp ^ a[i];
    y = x ^ k;
    if (num[x] > num[y]) {
      tmp = y;
      ans -= num[y];
      ++num[y];
    } else {
      tmp = x;
      ans -= num[x];
      ++num[x];
    }
  }
  cout << ans;
  return 0;
}
