import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable int INF = 1 << 29;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto X = (1L << K) - 1;
    auto A = readln.split.map!(to!long).array;

    long ans = 0;
    long tmp = 0;
    long[long] cnt;
    cnt[0] = 1;

    long f(long x) {
        if (x !in cnt) return 0;
        else return cnt[x];
    }

    foreach (i; 0..N) {
        long a = tmp ^ A[i];
        long b = a ^ X;
        if (f(a) <= f(b)) {
            ans += f(a);
            cnt[a] += 1;
            tmp = a;
        } else {
            ans += f(b);
            cnt[b] += 1;
            tmp = b;
        }
    }

    ans = N.to!long * (N.to!long + 1) / 2 - ans;
    ans.writeln;
}
