n,k=io.read("*n","*n","*l")
a={}
for i=1,n do
    a[i]=io.read("*n")
end

t={true}
s={}
for i=1,n do
    if not t[a[i]] then
        t[a[i]]=true
    else
        s={a[i],i}
    end
end

x=1
y=1
for i=1,n do
    if a[i]==s[1] then
        x=i
        y=s[2]-i
        break
    end
end
print(y>0 and a[x+(k-x)%y] or x)