#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define per(i,b,a) for(int i=b; i>=a; i--)
using namespace std;
const int maxn = 1e5 + 5 ;
int n, k ;
long long a[maxn] ;
long long pxor[maxn] ;
map<long long, int> mp ;
map<long long, bool> chk ;
long long getinv(long long mask)
{
rep(i,0,k-1)
{
mask ^= (1<<i) ;
}
return mask ;
}
int main()
{
ios::sync_with_stdio(false) ;
cin.tie(NULL) ;
cin >> n >> k ;
rep(i,0,n-1) cin >> a[i] ;
rep(i,0,n-1)
{
if(i)
pxor[i] = (pxor[i-1]^a[i]) ;
else pxor[i] = a[i] ;
mp[pxor[i]]++ ;
chk[pxor[i]] = false ;
}
long long ret = (n*1LL*(n+1))/2 ;
for(map<long long, int>::iterator it = mp.begin() ; it!=mp.end() ; it++)
{
long long inv = getinv(it->first) ;
// cout << it->first << " " << inv << "\n" ;
if(chk[it->first] || chk[inv]) continue ;
int cnt = mp[inv] ;
if(cnt > it->second)
{
long long sub = cnt-1 ;
long long add = it->second+1 ;
ret -= ((sub*(sub-1))/2 + (add*(add-1))/2) ;
chk[inv] = true ;
}
}
cout << ret << "\n" ;
return 0 ;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgcmVwKGksYSxiKSBmb3IoaW50IGk9YTsgaTw9YjsgaSsrKQojZGVmaW5lIHBlcihpLGIsYSkgZm9yKGludCBpPWI7IGk+PWE7IGktLSkKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBtYXhuID0gMWU1ICsgNSA7CmludCBuLCBrIDsKbG9uZyBsb25nIGFbbWF4bl0gOwpsb25nIGxvbmcgcHhvclttYXhuXSA7Cm1hcDxsb25nIGxvbmcsIGludD4gbXAgOwptYXA8bG9uZyBsb25nLCBib29sPiBjaGsgOwpsb25nIGxvbmcgZ2V0aW52KGxvbmcgbG9uZyBtYXNrKQp7CiAgICByZXAoaSwwLGstMSkKICAgIHsKICAgICAgICAgICAgbWFzayBePSAoMTw8aSkgOwogICAgfQogICAgcmV0dXJuIG1hc2sgOwp9CmludCBtYWluKCkKewogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpIDsKICAgIGNpbi50aWUoTlVMTCkgOwogICAgY2luID4+IG4gPj4gayA7CiAgICByZXAoaSwwLG4tMSkgY2luID4+IGFbaV0gOwogICAgcmVwKGksMCxuLTEpCiAgICB7CiAgICAgICAgaWYoaSkKICAgICAgICBweG9yW2ldID0gKHB4b3JbaS0xXV5hW2ldKSA7CiAgICAgICAgZWxzZSBweG9yW2ldID0gYVtpXSA7CiAgICAgICAgbXBbcHhvcltpXV0rKyA7CiAgICAgICAgY2hrW3B4b3JbaV1dID0gZmFsc2UgOwogICAgfQogICAgbG9uZyBsb25nIHJldCA9IChuKjFMTCoobisxKSkvMiA7CgogICAgZm9yKG1hcDxsb25nIGxvbmcsIGludD46Oml0ZXJhdG9yIGl0ID0gbXAuYmVnaW4oKSA7IGl0IT1tcC5lbmQoKSA7IGl0KyspCiAgICB7CiAgICAgICAgbG9uZyBsb25nIGludiA9IGdldGludihpdC0+Zmlyc3QpIDsKICAgICAgIC8vIGNvdXQgPDwgaXQtPmZpcnN0IDw8ICIgIiA8PCAgaW52IDw8ICJcbiIgOwogICAgICAgIGlmKGNoa1tpdC0+Zmlyc3RdIHx8IGNoa1tpbnZdKSBjb250aW51ZSA7CiAgICAgICAgaW50IGNudCA9IG1wW2ludl0gOwogICAgICAgIGlmKGNudCA+IGl0LT5zZWNvbmQpCiAgICAgICAgewogICAgICAgICAgICBsb25nIGxvbmcgc3ViID0gY250LTEgOwogICAgICAgICAgICBsb25nIGxvbmcgYWRkID0gaXQtPnNlY29uZCsxIDsKICAgICAgICAgICAgcmV0IC09ICgoc3ViKihzdWItMSkpLzIgKyAoYWRkKihhZGQtMSkpLzIpIDsKICAgICAgICAgICAgY2hrW2ludl0gPSB0cnVlIDsKICAgICAgICB9CiAgICB9CiAgICBjb3V0IDw8IHJldCA8PCAiXG4iIDsKICAgIHJldHVybiAwIDsKfQo=