"use strict";

var N, K, An;
function dec2bit(x) {
    var ret = [];
    for (var n = 0; n < 64; n++) {
        ret.unshift(x % 2);
        x = Math.floor(x / 2);
    }
    return ret;
}
function bit2dec(c) {
    var ret = 0, bit = 1;
    for (let n = c.length - 1; n > 0; --n) {
        if (c[n] == 1) ret += bit;
        bit *= 2;
    }
    return ret;
}
function xor(a, b) {
    let a1 = dec2bit(a);
    let b1 = dec2bit(b);
    let c1 = [];
    for (let n = 0; n < a1.length; n++) {
        if (a1[n] == 0) c1.push((b1[n] == 0) ? 0: 1);
        if (a1[n] == 1) c1.push((b1[n] == 0) ? 1: 0);
    }
    return bit2dec(c1);
}
function f(x) {
    return An.reduce((ac, value) => ac + xor(x, value), 0);
}
function Main(input) {
    let lines = input.split("\n");
    let nums = lines.shift().split(/\s/);
    N = nums[0] - 0;
    K = nums[1] - 0;
    An = lines[0].split(/\s/).map(function(value) { return value - 0; });

    var ans = -1;
    for (var x = 0; x <= K; x++) {
        let fx = f(x);
        ans = Math.max(ans, fx);
    }

    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
