function main(input) {
    const args = input.split('\n');
    const Args = args[0].split(' ')
  	const N = parseInt(Args[0], 10)
    const K = parseInt(Args[1], 10)
    const A = args[1].split(' ').map(Number).sort(B)

    var aa = C(A)
    
    var Ans = D(aa,A)
 	console.log(Ans)   
}

var B = (a,b)=>{
  if( a > b ) return -1;
        if( a < b ) return 1;
        return 0;
}

var C=(a)=>{
	var c = 0&0
    for (var i=0;i<a.length;i++){
    	c = c ^ a
    }
  	return c
}

var D = (x,a)=>{
	var y = 0&0
    for(var f of a){
    	y += f^a
    }
  	return y
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));