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;

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

    if (N == 1) {
        writeln(K % 2 ? A.front.to!string : "");
        return;
    }

    auto next = new int[](N);
    next[] = -1;
    int[long] prev;

    foreach (i; 0..2*N) {
        int idx = i % N;
        if (A[idx] in prev) {
            next[prev[A[idx]]] = idx;
        }
        prev[A[idx]] = idx;
    }


    int[int] mem;
    Tuple!(int, long)[] mem_array;
    long lap = 0;
    int idx = 0;

    while(true) {
        if (idx in mem) {
            break;
        } else {
            mem[idx] = mem_array.length.to!int;
            mem_array ~= tuple(idx, lap);
        }
        if (next[idx] <= idx) lap++;
        idx = (next[idx] + 1) % N;
    }

    lap++;
    long loop_length = lap - mem_array[mem[idx]][1];
    if (loop_length == 0) {
        writeln;
        return;
    }
    K %= loop_length;
    int tar_idx;

    foreach (i; 0..mem_array.length.to!int) {
        tar_idx = i;
        if (mem_array[i][1] >= K - 1) break;
    }

    idx = mem_array[tar_idx][0];
    long[] ans;

    while (idx >= tar_idx) {
        int nx;
        if (next[idx] > idx) nx = (next[idx]+1) % N;
        else nx = (idx + 1) % N, ans ~= A[idx];
        if (nx <= idx) break;
        idx = nx;
    }

    ans.map!(to!string).join(" ").writeln;
}