#include <bits/stdc++.h>
using namespace std;
#pragma clang diagnostic push
#pragma ide diagnostic ignored "modernize-use-nullptr"
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
const char NL = '\n';
#pragma clang diagnostic pop
const size_t SIZE = static_cast<const size_t>(1000);
uint_fast16_t l[SIZE];
uint_fast16_t r[SIZE];
uint_fast16_t a[SIZE];
uint_fast32_t gcd(uint_fast32_t a, uint_fast32_t b) {
  uint_fast32_t r = a % b;
  return r ? gcd(b, r) : b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
#pragma clang diagnostic pop
  istream &inp = cin;
  ostream &outp = cout;
  uint_fast64_t n, k;
  inp >> n >> k;
  uint_fast64_t inv = (((uint_fast64_t)1) << k) - 1;
  map<uint_fast64_t, uint_fast64_t> m;
  ++m[0];
  uint_fast64_t ans = n * (n + 1) / 2;
  uint_fast64_t sum = 0;
  for (uint_fast64_t i = 0; i < n; ++i) {
    uint_fast64_t x;
    inp >> x;
    sum ^= x;
    uint_fast64_t &sv = m[sum];
    if (sv) {
      uint_fast64_t alt = sum ^ inv;
      uint_fast64_t &av = m[alt];
      if (sv > av) {
        sum = alt;
        ans -= ++av - 1;
        continue;
      }
    }
    ans -= ++sv - 1;
  }
  outp << ans;
  return 0;
}
