#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
const int oo = 1e9;
const int MOD = 1000000007;
int n, k, a[N];
map<long long, int> freq;
long long inv(long long r) { return (~r) & ((1ll << k) - 1); }
long long total = 0;
int main() {
  cin >> n >> k;
  freq[0]++;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    long long g = inv(a[i]) ^ (i ? a[i - 1] : 0);
    long long f = a[i] ^ (i ? a[i - 1] : 0);
    if (freq[f] <= freq[g]) {
      total += freq[f];
      a[i] = f;
    } else {
      total += freq[g];
      a[i] = g;
    }
    freq[a[i]]++;
  }
  total = ((n) * (1ll * n + 1)) / 2 - total;
  cout << total << endl;
  return 0;
}
