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.*;
import java.util.*;

class Solver {
  private static final long INF = 1_000_000_000_000_000_000L;
  
  final int n;
  final long k;
  final int[] as;
  
  int[] ys;
  long[][] gm;
  
  Solver(int n, long k, int[] as) {
    this.n = n;
    this.k = k;
    this.as = as;
  }
  
  private long calculate(long apply) {
    long sum = 0;
    int a = 0;
    for (int i = 62; i >= 0; i--) {
      if (((apply >> i) & 1) == 1) {
        sum += gm[i][a];
        a += (int)(gm[i][a] % n);
        a %= n;
        if (sum >= INF) {
          return INF;
        }
      }
    }
    return sum;
  }
  
  private boolean exceed(long apply) {
    return calculate(apply) >= (long)n * k;
  }
  
  public Deque<Integer> solve() {
//    System.err.println("solve: 1");
    Map<Integer, TreeSet<Integer>> xMapSet = new HashMap<>();
    for (int i = 0; i < n; i++) {
      if (xMapSet.get(as[i]) == null) {
        xMapSet.put(as[i], new TreeSet<>());
      }
      xMapSet.get(as[i]).add(i);
    }
    
//    System.err.println("solve: 2");
    ys = new int[n];
    for (int i = 0; i < n; i++) {
      Integer j = xMapSet.get(as[i]).higher(i);
      if (j != null) {
        ys[i] = j + 1 - i;
      } else {
        j = xMapSet.get(as[i]).first();
        ys[i] = n + j + 1 - i;
      }
    }
    
//    System.err.println("solve: 3");
    gm = new long[64][n];
    for (int j = 0; j < n; j++) {
      gm[0][j] = ys[j];
    }
    
//    System.err.println("solve: 4");
    for (int i = 1; i < 64; i++) {
      for (int j = 0; j < n; j++) {
        gm[i][j] = gm[i - 1][j] + gm[i - 1][(int)((j + gm[i - 1][j]) % n)];
        if (gm[i][j] > INF) {
          gm[i][j] = INF;
        }
      }
    }
    
//    System.err.println("solve: 5");
    long maxApply = (long)n * k;
    long minApply = 0;
    while (maxApply - minApply > 1) {
      long midApply = (maxApply + minApply) / 2;
//      System.err.printf("%d %d %d\n", minApply, maxApply, midApply);
      if (exceed(midApply)) {
        maxApply = midApply;
      } else {
        minApply = midApply;
      }
    }
    
//    System.err.println("solve: 6");
    long a = calculate(minApply);
    Deque<Integer> deque = new ArrayDeque<>();
    Set<Integer> inDeque = new HashSet<>();
    for (int i = (int)(a % n); i < n; i++) {
      if (inDeque.contains(as[i])) {
        while (true) {
          int polled = deque.pollLast();
          inDeque.remove(polled);
          if (polled == as[i]) {
            break;
          }
        }
      } else {
        deque.addLast(as[i]);
        inDeque.add(as[i]);
      }
    }
    return deque;
  }
}

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    long k = reader.nextLong();
    int[] as = reader.nextInt(n);
    Deque<Integer> deque = new Solver(n, k, as).solve();
    while (!deque.isEmpty()) {
      out.println(deque.pollFirst());
    }
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}
