#include <bits/stdc++.h>
using namespace std;
const long long int Maxn = 2e5 + 5, Mod = 1e9 + 7, Inf = 1e9 + 5;
long long int ans;
int n, k, psxor[Maxn], p;
map<int, int> cnt;
long long int C(long long int x) { return (x * (x - 1ll)) / 2ll; }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  ans = C(n + 1);
  p = (1 << k) - 1;
  cnt[0] = 1;
  for (int i = 1; i <= n; i++) {
    int ai;
    cin >> ai;
    psxor[i] = (psxor[i - 1] ^ ai);
    cnt[min(psxor[i], p - psxor[i])]++;
  }
  for (int i = 1; i <= n; i++) {
    int x = cnt[min(psxor[i], p - psxor[i])];
    cnt[min(psxor[i], p - psxor[i])] = 0;
    ans -= C(x / 2);
    ans -= C((x + 1) / 2);
  }
  cout << ans << '\n';
  return 0;
}
