function main(input) {
    const lines = input.trim().split(/\n/);
    const max = Number(lines[0].split(/\s/)[1]);
    var res = 0;
    for(var i = 0; i <= max; i++){
        const sum =lines[1].split(/\s/).map(str => { return Number(str) })
            .reduce((pre,rest)=>{
                console.log(rest)
                return pre + (rest ^ i);
            },0);
        res = Math.max(res,sum);
    }
    console.log(res);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));