#include<bits/stdc++.h>
using namespace std;
int a[200005],n,b[200005];
int c[200005],d[200005];
long long k;
int t=1;
int main()
{
  memset(c,0,sizeof(c));
  cin>>n>>k;
  for(int i=1;i<=n;i++)
  {
  	cin>>a[i];
    b[d[a[i]]]=i;
    if(c[a[i]]==0)
	  c[a[i]]=i;
	b[i]=c[a[i]];
	d[a[i]]=i;
  }
  if(n>1)
  {
    int p=1;
    while(1)
	{
      if(b[p]<=p)
	    t++;
      p=b[p];
      if(p==n)
	    break;
      p++;
    }
    k%=t;
    p=1;
    t=1;
    while(t<=k)
	{
	  if(b[p]<=p)
		t++;
	  if(t<=k)
	  {
		p=b[p];
		p++;
	  }
	}
    for(int i=p;i<=n;i++)
      if(b[i]>i)
	    i=b[i];
      else 
        cout<<a[i]<<" ";
    }
    else
    { 
      if(k%2)
        cout<<a[1];
    } 
    return 0;
}