#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
ll a[200005];
map<ll,ll>freq;
int main()
{
int n,k;
cin>>n>>k;
int fff=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
freq[0]++;
ll aa,bb=0;
ll curr=0;
for(int i=0;i<n;i++)
{
aa = curr;
bb=0;
for(int j=0;j<k;j++)
{
if((a[i]&(1<<j)))
{
aa^=(1<<j);
}
}
for(int j=0;j<k;j++)
{
if(!(aa&(1<<j)))
{
bb|=(1<<j);
}
}
if(freq[aa]<freq[bb])
{
freq[aa]++;
curr = aa;
}
else
{
curr = bb;
freq[bb]++;
}
//curr = aa;
}
map<ll,ll>::iterator it = freq.begin();
ll sum=0;
for(;it!=freq.end();it++)
{
ll ff = it->second;
sum = sum+1LL*(ff)*(ff-1)/2;
}
ll fin = 1LL*n*(n+1)/2;
cout<<fin-sum<<endl;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgcGIgcHVzaF9iYWNrCnR5cGVkZWYgbG9uZyBsb25nIGxsOwpsbCBhWzIwMDAwNV07Cm1hcDxsbCxsbD5mcmVxOwppbnQgbWFpbigpCnsKICAgIGludCBuLGs7CiAgICBjaW4+Pm4+Pms7CiAgICBpbnQgZmZmPTA7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgewogICAgICAgIGNpbj4+YVtpXTsKICAgIH0KICAgIGZyZXFbMF0rKzsKICAgIGxsIGFhLGJiPTA7CiAgICBsbCBjdXJyPTA7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgewogICAgICAgIGFhID0gY3VycjsKICAgICAgICBiYj0wOwogICAgICAgIGZvcihpbnQgaj0wO2o8aztqKyspCiAgICAgICAgewogICAgICAgICAgICBpZigoYVtpXSYoMTw8aikpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBhYV49KDE8PGopOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvcihpbnQgaj0wO2o8aztqKyspCiAgICAgICAgewogICAgICAgICAgICBpZighKGFhJigxPDxqKSkpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGJifD0oMTw8aik7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYoZnJlcVthYV08ZnJlcVtiYl0pCiAgICAgICAgewogICAgICAgICAgICBmcmVxW2FhXSsrOwogICAgICAgICAgICBjdXJyID0gYWE7CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIGN1cnIgPSBiYjsKICAgICAgICAgICAgZnJlcVtiYl0rKzsKICAgICAgICB9CiAgICAgICAgLy9jdXJyID0gYWE7CiAgICB9CiAgICBtYXA8bGwsbGw+OjppdGVyYXRvciBpdCA9IGZyZXEuYmVnaW4oKTsKICAgIGxsIHN1bT0wOwogICAgZm9yKDtpdCE9ZnJlcS5lbmQoKTtpdCsrKQogICAgewoKICAgICAgICBsbCBmZiA9IGl0LT5zZWNvbmQ7CiAgICAgICAgc3VtID0gc3VtKzFMTCooZmYpKihmZi0xKS8yOwogICAgfQogICAgbGwgZmluID0gMUxMKm4qKG4rMSkvMjsKICAgIGNvdXQ8PGZpbi1zdW08PGVuZGw7Cn0K