#include <bits/stdc++.h>
using namespace std;
const int inf_int = 1e9 + 100;
const long long inf_ll = 1e16;
const double pi = 3.1415926535898;
bool debug = 0;
const int MX = 1e7 + 100;
const int MAXN = 2e5 + 100;
const int LOG = 20;
const long long mod = 998244353;
int a[MAXN];
void solve() {
  int n, k;
  cin >> n >> k;
  map<int, int> mp;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  int pref = 0;
  int mask = (1 << k) - 1;
  mp[0] = 1;
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    int val1 = pref ^ a[i];
    int val2 = val1 ^ mask;
    int cur = -1;
    if (mp[val1] < mp[val2]) {
      cur = val1;
    } else {
      cur = val2;
    }
    if (debug)
      cout << val1 << " " << val2 << " " << mp[val1] << " " << mp[val2] << endl;
    pref = cur;
    ans += i - mp[pref];
    mp[pref]++;
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  int t = 1;
  while (t--) solve();
}
