#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  a = ((a) < 0 ? -(a) : (a));
  b = ((b) < 0 ? -(b) : (b));
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
const long long inf = 2147383647;
const long long mod = 1000000007;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;
int n, k, ar[200005], cxor[200005];
map<int, int> am, cnt;
int main() {
  cin >> n >> k;
  long long ans, tmp, a, b;
  int x, high;
  high = (1 << k) - 1;
  tmp = n;
  tmp = (tmp * (tmp + 1)) / 2;
  ans = tmp;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ar[i]);
  }
  cxor[0] = 0;
  for (int i = 1; i <= n; i++) {
    cxor[i] = cxor[i - 1] ^ ar[i];
  }
  for (int i = 0; i <= n; i++) {
    x = min(cxor[i], high - cxor[i]);
    cnt[x]++;
  }
  for (int i = 0; i <= n; i++) {
    x = min(cxor[i], high - cxor[i]);
    if (!am[x]) {
      am[x] = 1;
      a = cnt[x];
      b = a / 2;
      a = a - b;
      tmp = (a * (a - 1)) / 2;
      ans -= tmp;
      tmp = (b * (b - 1)) / 2;
      ans -= tmp;
    }
  }
  cout << ans << "\n";
  return 0;
}
