We have a sequence of N \times K integers: X=(X_0,X_1,\cdots,X_{N \times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\cdots,A_{N-1}). For each pair i, j (0 \leq i \leq K-1,\ 0 \leq j \leq N-1), X_{i \times N + j}=A_j holds.

Snuke has an integer sequence s, which is initially empty. For each i=0,1,2,\cdots,N \times K-1, in this order, he will perform the following operation:

* If s does not contain X_i: add X_i to the end of s.
* If s does contain X_i: repeatedly delete the element at the end of s until s no longer contains X_i. Note that, in this case, we do not add X_i to the end of s.



Find the elements of s after Snuke finished the operations.

Constraints

* 1 \leq N \leq 2 \times 10^5
* 1 \leq K \leq 10^{12}
* 1 \leq A_i \leq 2 \times 10^5
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N K
A_0 A_1 \cdots A_{N-1}


Output

Print the elements of s after Snuke finished the operations, in order from beginning to end, with spaces in between.

Examples

Input

3 2
1 2 3


Output

2 3


Input

5 10
1 2 3 2 3


Output

3


Input

6 1000000000000
1 1 2 2 3 3


Output




Input

11 97
3 1 4 1 5 9 2 6 5 3 5


Output

9 2 6
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Set;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B_DoNotDuplicate solver = new B_DoNotDuplicate();
        solver.solve(1, in, out);
        out.close();
    }

    static class B_DoNotDuplicate {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            final int N = (int) (2e5 + 1);
            int n = in.nextInt();
            long k = in.nextLong();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }

            int[] whoLeavesIfStartAt = new int[n + 1];
            int[] latest = new int[N + 1];
            Arrays.fill(latest, n);
            whoLeavesIfStartAt[n] = N;
            for (int i = n - 1; i >= 0; i--) {
                int x = a[i];
                if (latest[x] == n) {
                    whoLeavesIfStartAt[i] = x;
                } else {
                    whoLeavesIfStartAt[i] = whoLeavesIfStartAt[latest[x] + 1];
                }
                latest[x] = i;
            }

            int[] whoLeavesIfXEnters = new int[N + 1];
            for (int x = 0; x < N; x++) {
                if (latest[x] == n) {
                    continue;
                }
                whoLeavesIfXEnters[x] = whoLeavesIfStartAt[latest[x] + 1];
            }
            whoLeavesIfXEnters[N] = whoLeavesIfStartAt[0];

            --k;
            int[] seen = new int[N + 1];
            Arrays.fill(seen, -1);
            int cur = N;
            int step;
            for (step = 0; step < k; step++) {
                if (seen[cur] >= 0) {
                    break;
                }
                seen[cur] = step;
                cur = whoLeavesIfXEnters[cur];
            }

            int cycleLength = step - seen[cur];
            long stepsLeft = step == k ? 0 : (k - step) % cycleLength;
            while (stepsLeft > 0) {
                cur = whoLeavesIfXEnters[cur];
                --stepsLeft;
            }

            int pos = Math.min(n, cur == N ? 0 : latest[cur] + 1);
            int[] c = simulate(Arrays.copyOfRange(a, pos, n));

            for (int i = 0; i < c.length; i++) {
                if (i > 0) {
                    out.print(" ");
                }
                out.print(c[i]);
            }
            out.println();
        }

        private int[] simulate(int[] a) {
            int[] b = new int[a.length];
            int p = 0;
            Set<Integer> set = new HashSet<>();
            for (int x : a) {
                if (!set.contains(x)) {
                    b[p++] = x;
                    set.add(x);
                } else while (set.contains(x)) {
                    set.remove(b[--p]);
                }
            }
            return Arrays.copyOf(b, p);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

