using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[]str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		long K = long.Parse(str[1]);
		int[]A = new int[N];
		string[]str2 = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = int.Parse(str2[i]);
		}
		var dic = new Dictionary<int,int>();
		var dic2 = new Dictionary<int,int>();
		var dics = new Dictionary<int,int>();
		int[]B = new int[N];
		int[]B2 = new int[N];
		for(var i=0;i<N;i++){
			if(dic.ContainsKey(A[i])){
				dic[A[i]]++;
				B2[i] = dic2[A[i]];
			} else {
				dic[A[i]] = 1;
				B2[i] = -1;
              	dics[A[i]] = i;
            }
			dic2[A[i]]=i;
			B[i] = dic[A[i]];
		}
		var dic3 = new Dictionary<int,int>();
		var dic4 = new Dictionary<int,int>();
		int[]B3 = new int[N];
		int[]B4 = new int[N];
		for(var i=N-1;i>=0;i--){
			if(dic3.ContainsKey(A[i])){
				dic3[A[i]]++;
				B4[i] = dic4[A[i]];
			} else {
				dic3[A[i]] = 1;
				B4[i] = -1;
			}
			dic4[A[i]]=i;
			B3[i] = dic3[A[i]];
		}
		int di = 0;
      	long[]L = new long[N];
      	var ans = new List<int>();
		while(true){
          	//Console.Error.WriteLine(K+" "+di);
          	if(L[di]>0){
              	if(K%(L[di]-K)==0){
                  K=K%(L[di]-K)+(L[di]-K);
                } else {
                  K=K%(L[di]-K);
                }
            }
          	L[di] = K;
			int T = dic[A[di]];
          	int T2 = B4[di];
			//Console.Error.WriteLine(T+" "+T2);
          	if(T2==-1){
              	if(K==1){
                  for(var i=di;i<N;i++){
                    ans.Add(A[i]);
                  }
                  break;
                } else {
                  	if(T==1){
                      	K -= 1;
                      	di += 1;
                      	if(di==N){
                          K -= 1;
                          di = 0;
                          if(K==0){
                            break;
                          }
                        }
                    } else {
                      	K -= 1;
	                  	di = dics[A[di]] + 1;
                      	if(di==N){
                          K -= 1;
                          di = 0;
                          if(K==0){
                            break;
                          }
                        }
                    }
                }
            } else {
              	di = T2;
              	di = di + 1;
              	if(di==N){
                  K -= 1;
                  di = 0;
                  if(K==0){
                    break;
                  }
                }
            }
		}
      	if(ans.Count>0){
          var dic5 = new Dictionary<int,int>();
          int[]B5 = new int[N];
          for(var i=ans.Count-1;i>=0;i--){
            if(dic5.ContainsKey(ans[i])){
              dic5[ans[i]]++;
              B5[i] = dic5[ans[i]];
            } else {
              dic5[ans[i]]=1;
              B5[i] = 1;
            }
          }
          var ans2 = new List<int>();
          int flag = -1;
          for(var i=0;i<ans.Count;i++){
            if(flag == -1){
            if(B5[i]==1){
              ans2.Add(ans[i]);
            } else {
              flag = ans[i];
            }
            } else {
              if(ans[i]==flag){
                flag = -1;
              }
            }
          }
          if(ans2.Count>0){
          Console.Write(ans2[0]);
      		for(var i=1;i<ans2.Count;i++){
          	Console.Write(" "+ans2[i]);
        	}
          }
        }
	}
}

Measured memory_bytes: 68724