#include <bits/stdc++.h>
using namespace std;
inline void file() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  if (0) {
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
  }
}
const int PX[8] = {1, 0, -1, 0, 1, 1, -1, -1},
          PY[8] = {0, 1, 0, -1, -1, 1, 1, -1}, N = 1010, INF = 1e9,
          MOD = 1e9 + 7;
const long long INFL = 1e18, MODL = 1e9 + 7;
const long double EPS = 1e-6;
template <typename type>
inline void up(type& a, type b) {
  if (a < b) a = b;
}
inline long long rnd(long long l = 1, long long r = INFL) {
  unsigned long long ans = rand();
  ans = (ans << 16LL) ^ rand();
  ans = (ans << 16LL) ^ rand();
  ans = (ans << 16LL) ^ rand();
  ans %= r - l + 1;
  return (long long)ans + l;
}
int n, k, p, mask, x;
long long ans;
map<int, int> sum;
int main() {
  file();
  scanf("%d %d", &n, &k);
  mask = (1 << k) - 1;
  p = 0;
  sum[p] = 1;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    int v1, v2;
    v1 = p ^ x;
    v2 = p ^ x ^ mask;
    int s1, s2;
    s1 = s2 = 0;
    if (sum.count(v1)) s1 = sum[v1];
    if (sum.count(v2)) s2 = sum[v2];
    if (s1 > s2) {
      swap(s1, s2);
      swap(v1, v2);
    }
    p = v1;
    ans += s1;
    sum[p]++;
  }
  ans = (long long)n * (n + 1) / 2 - ans;
  cout << ans;
}
