#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)2e5 + 5;
const long long mod = (long long)1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long rev = (1 << k) - 1LL;
  map<long long, long long> mp;
  long long pre = 0, res = 0;
  mp[0] = 1;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    long long pre1 = x ^ pre;
    long long pre2 = pre1 ^ rev;
    long long cur = -1;
    if (mp[pre1] < mp[pre2])
      cur = pre1;
    else
      cur = pre2;
    pre = cur;
    res += (i + 1 - mp[pre]);
    mp[pre]++;
  }
  cout << res;
  return 0;
}
