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.OutputStream;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class BDoNotDuplicate {
        private static final int MAX = 200_001;

        public void solve(int testNumber, LightScanner in, LightWriter out) {
            // out.setBoolLabel(LightWriter.BoolLabel.YES_NO_FIRST_UP);
            int n = in.ints();
            long k = in.longs();
            int[] a = in.ints(n);

        /*if (n * k <= 50_000_000) {
            int[] array = new int[MAX];
            int len = 0;
            int[] index = new int[MAX];
            Arrays.fill(index, -1);
            for (long turn = 0; turn < k * n; turn++) {
                int j = (int) (turn % n);
                if (j == 0) System.out.println("=== " + turn / n);
                if (index[a[j]] >= 0 && index[a[j]] < len && array[index[a[j]]] == a[j]) {
                    //System.out.print("Add");
                    len = index[a[j]];
                } else {
                    //System.out.print("Rem");
                    array[len] = a[j];
                    index[a[j]] = len++;
                }
                if (len == 0) System.out.println(a[j] + " Done: " + turn);
                //System.out.println(a[j] + " " + Arrays.toString(Arrays.copyOf(array, len)));
            }
            out.ans(Arrays.copyOf(array, len)).ln();
            return;
        }*/

            int[] firstIndexOf = new int[MAX], lastIndexOf = new int[MAX], correspondsTo = new int[n];
            Arrays.fill(firstIndexOf, -1);
            Arrays.fill(lastIndexOf, -1);
            ArrayUtil.fill(correspondsTo, -1);
            for (int i = 0; i < n; i++) {
                if (firstIndexOf[a[i]] < 0) firstIndexOf[a[i]] = i;
                if (lastIndexOf[a[i]] >= 0) correspondsTo[lastIndexOf[a[i]]] = i;
                lastIndexOf[a[i]] = i;
            }
            for (int i = 0; i < n; i++) {
                if (correspondsTo[i] < 0) correspondsTo[i] = n + firstIndexOf[a[i]];
            }
            int[] next = new int[n], size = new int[n];
            for (int i = 0; i < n; i++) {
                next[i] = (correspondsTo[i] + 1) % n;
                size[i] = correspondsTo[i] - i + 1;
            }
            long totalSize = size[0];
            for (int cur = next[0]; cur != 0; cur = next[cur]) totalSize += size[cur];
            //System.out.println(Arrays.toString(next));
            //System.out.println(Arrays.toString(size));
            long remain = (n * k) % totalSize;
            int cur = 0;
            while (size[cur] <= remain) {
                remain -= size[cur];
                cur = next[cur];
            }

            int[] array = new int[MAX];
            int len = 0;
            int[] index = new int[MAX];
            Arrays.fill(index, -1);
            for (int turn = cur; turn < cur + remain; turn++) {
                int j = turn % n;
                if (index[a[j]] >= 0 && index[a[j]] < len && array[index[a[j]]] == a[j]) {
                    len = index[a[j]];
                } else {
                    array[len] = a[j];
                    index[a[j]] = len++;
                }
            }
            out.ans(Arrays.copyOf(array, len)).ln();
            out.ln();
        }

    }

    static final class ArrayUtil {
        private ArrayUtil() {
        }

        public static void fill(int[] a, int v) {
            Arrays.fill(a, v);
        }

    }

    static class LightWriter implements AutoCloseable {
        private final Writer out;
        private boolean autoflush = false;
        private boolean breaked = true;

        public LightWriter(Writer out) {
            this.out = out;
        }

        public LightWriter(OutputStream out) {
            this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));
        }

        public LightWriter print(char c) {
            try {
                out.write(c);
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter print(String s) {
            try {
                out.write(s, 0, s.length());
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter ans(String s) {
            if (!breaked) {
                print(' ');
            }
            return print(s);
        }

        public LightWriter ans(int i) {
            return ans(Integer.toString(i));
        }

        public LightWriter ans(int... n) {
            for (int n1 : n) {
                ans(n1);
            }
            return this;
        }

        public LightWriter ln() {
            print(System.lineSeparator());
            breaked = true;
            if (autoflush) {
                try {
                    out.flush();
                } catch (IOException ex) {
                    throw new UncheckedIOException(ex);
                }
            }
            return this;
        }

        public void close() {
            try {
                out.close();
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

        public int[] ints(int length) {
            return IntStream.range(0, length).map(x -> ints()).toArray();
        }

        public long longs() {
            return Long.parseLong(string());
        }

    }
}

