function Main(input) {
	input = input.split("\n");
	input1 = input[0].split(" ")
	const N = parseInt(input1[0])
	const K = parseInt(input1[1])
	const As = input[1].split(" ")
	var filtered = ""
	var results = [""]
	for(i=0; i < K; i++){
		for(j=0; j < N; j++){
			if(filtered.includes(As[j])){
				var id = filtered.indexOf(As[j])
				filtered = filtered.slice(0, id)
			}else{
				filtered += As[j]
			}
		}
		if(results.indexOf(filtered) == -1){
			results.push(filtered)
		}else{
			break
		}
	}
	const roopstart = results.indexOf(filtered)
	if(roopstart == K){
		var result = results[roopstart]
		var answer = ""
		for(i=0; i < result.length; i++){
			answer = i == result.length-1 ? answer + result[i] : answer + result[i] + " "
		}
		console.log(answer)
	}else{
		const roopId = (K - roopstart) % (results.length - roopstart)
		var result =results[roopstart + roopId]
		var answer = ""
		for(i=0; i < result.length; i++){
			answer = i == result.length-1 ? answer + result[i] : answer + result[i] + " "
		}
		console.log(answer)
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));