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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	static final int MAX = 200002;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		long K = sc.nextLong() * N;
		int[] A = new int[2 * N];
		for (int i = 0; i < N; i++) {
			A[N + i] = A[i] = sc.nextInt();
		}
		int[] last = new int[MAX];
		Arrays.fill(last, -1);
		int[] next = new int[N];
		for (int i = 0; i < 2 * N; i++) {
			if (last[A[i]] != -1) {
				next[last[A[i]]] = i % N;
			}
			last[A[i]] = i % N;
		}
		int[] sum = new int[N];
		for (int i = 0; i < N; i++) {
			sum[i] = next[i] - i;
			if (sum[i] <= 0) sum[i] += N;
			sum[i]++;
		}
		boolean[] visited = new boolean[N];
		long[] position = new long[N];
		long cicle = 0;
		int current = 0;
		while (!visited[current]) {
			visited[current] = true;
			position[current] = cicle;
			cicle += sum[current];
			current += sum[current];
			current %= N;
		}
		long realCicle = cicle - position[current];
		long begin = position[current];
		int from = 0;
		if (K > begin) {
			K -= begin;
			from = current;
			K %= realCicle;
		}
		
		int[] values = new int[N + 2];
		boolean[] got = new boolean[MAX];
		int size = 0;
		while (K > 0) {
			if (sum[from] <= K) {
				K -= sum[from];
				from += sum[from];
				from %= N;
			} else {
				while (K > 0) {
					int val = A[from];
					if (got[val]) {
						while (values[size - 1] != val) {
							got[values[size - 1]] = false;
							size--;
						}
						got[values[size - 1]] = false;
						size--;
					} else {
						got[val] = true;
						values[size++] = val;
					}
					K--;
					from++;
					from %= N;
				}
			}
		}
		for (int i = 0; i < size; i++) {
			if (i > 0) out.print(" ");
			out.print(values[i]);
		}
		out.println();
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}
