#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  int a;
  unordered_map<int, int> count;
  count[0] = 1;
  int prev = 0;
  long long res = 0;
  for (int i = (0); i < (n); i++) {
    cin >> a;
    int x = prev ^ a;
    int cx = 0;
    if (count.count(x) > 0) {
      cx = count[x];
    }
    int na = a ^ ((1 << k) - 1);
    int nx = prev ^ na;
    int cnx = 0;
    if (count.count(nx) > 0) {
      cnx = count[nx];
    }
    if (cx < cnx) {
      res += cx;
      count[x] = cx + 1;
      prev ^= a;
    } else {
      res += cnx;
      count[nx] = cnx + 1;
      prev ^= na;
    }
  }
  cout << (n * (n + 1) / 2 - res) << "\n";
  return 0;
}
