#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 ;
}
