#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long inf = 10000000;
const double pi = acos(-1.0);
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) {
  a %= MOD;
  (a < 0) && (a += MOD);
}
inline long long modMul(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  return (a * b) % MOD;
}
inline long long modAdd(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  return (a + b) % MOD;
}
inline long long modSub(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, MOD - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
inline bool checkBit(long long n, int i) { return n & (1LL << i); }
inline long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
void input(long long n, const long long a[], int co = 0) {
  long long i = 1;
  for (; i <= n; i++) {
    if (co == 0)
      scanf("%lld", &a[i]);
    else
      printf("%lld ", a[i]);
  }
}
void dfs() {}
bool cmp() {}
long long solve(long long n) { return n * (n - 1) / 2; }
int main() {
  long long n, k;
  scanf("%lld %lld", &n, &k);
  k = 1ll << k;
  k--;
  long long ans = n * (n + 1) / 2;
  map<long long, long long> X;
  X[0]++;
  long long x = 0;
  while (n--) {
    long long y;
    scanf("%lld", &y);
    x = x ^ y;
    if (x & 1) x ^= k;
    X[x]++;
  }
  for (auto it : X) {
    long long p = it.second;
    ans -= solve(p / 2);
    p -= (p / 2);
    ans -= solve(p);
  }
  printf("%lld\n", ans);
  return 0;
}
