Harryxun/stf_run huggingface dataset:
N=int(input())
a=list(map(int,input().split()))
def u(x,y):
    if x%y==0:
        return y
    else:
        return u(y,x%y)
b=list(range(N-1))
for i in range(1,N):
    b[i]=u(b[i-1],a[i])
print(int(b[N-2]))

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
def u(x,y):
    if x%y==0:
        return y
    else:
        return u(y,x%y)
b=list(range(N))
b[0]=a[0]
for i in range(1,N):
    b[i]=u(b[i-1],a[i])
print(int(b[N-1]))
S,W=input().split()
if S<=W:
  print(unsafe)
else:
  print(safe)

### FIXED CODE ###

s,w=map(int, input().split())
if s<=w:
  print("unsafe")
else:
  print("safe")
# -*- coding: <encode name> -*-

r = int(input())
input(3 * r * r)

### FIXED CODE ###

# -*- coding: <encode name> -*-

r = int(input())
print(3 * r * r)
from collections import Counter
from collections import defaultdict 

N,M = map(int,input().split())
dict = defaultdict(set)

for i in range(M):
    a,b = list(map(int,input().split()))  
    
    dict[a].add(b)
    dict[b].add(a)



color = [0 for i in range(N+1)]
res = True

def dfs(v,c,queue=[]):
    u'''
    v : 現在のグラフの頂点
    c : 現在参照するフラグ,1=>-1=>1と使うので渡す必要がある
    queue : 探索したグラフの頂点を入れていく
    res : global変数を使いたくないが,再帰のreturnがよくわからないのでとりあえず
    '''

    global color
    global res 
    queue.append(v)
    
    for i in list(dict[v]):
        if color[i] == c:#隣の頂点が同じ値を与えられている際Falseを返す
            res = False
        elif i not in queue:#探索済みでなければ再帰する

            color[i] = c*-1#0ならcとは異なる値を格納
            dfs(i,-c,queue)#引数に-cとすることで,cが1=>-1=>1を繰り返す


color[1] = 1#始点色分けする
dfs(1,1)

if res:
    counter = Counter(color)
    B = counter[1]
    W = counter[-1]
    print(B*W-M)

else:
    print(int(N*(N-1)/2 - M))
    
            


### FIXED CODE ###

from collections import deque
from collections import defaultdict
from collections import Counter

N,M = list(map(int,input().split()))
G = defaultdict(set)

color = [0 for i in range(N+1)]

for _ in range(M):
    A,B = map(int,input().split())
    G[A].add(B)
    G[B].add(A)

color[1] = 1
que = deque([1])
concatenation = False

while len(que):
    p = que.popleft()
    for q in list(G[p]):
        if color[q] == 0:
            color[q] = -color[p]
            que.append(q)
        elif color[q] == color[p]:
            concatenation = True
            break
    
if concatenation:
    print(int(N*(N-1)/2-M))
else:
    B = Counter(color)[1]
    W = Counter(color)[-1]
    print(B*W-M)
import itertools

def AllPatern(n, all):
    numbers = []
    all = []
    for i in range(n):
        numbers.append(i+1)
    for i in itertools.permutations(numbers):
        all.append(list(i))

    return all


def WhichNumber(p, q, all):
    val_p = 0
    val_q = 0
    for i in range(len(all)):
        val_p += 1
        if p == all[i]:
            break
    for i in range(len(all)):
        val_q += 1
        if q == all[i]:
            break

    return val_p, val_q

def main():
    n = int(input())
    p = [int(i) for i in input().split()]
    q = [int(i) for i in input().split()]
    all_numbers=[]

    all_numbers = AllPatern(n, all_numbers)
    val_p, val_q = WhichNumber(p, q, all)
    print(abs(val_p - val_q))



if __name__ == '__main__':
    main()


### FIXED CODE ###

import itertools

def AllPatern(n, all):
    numbers = []
    all = []
    for i in range(n):
        numbers.append(i+1)
    for i in itertools.permutations(numbers):
        all.append(list(i))

    return all


def WhichNumber(p, q, all):
    val_p = 0
    val_q = 0
    for i in range(len(all)):
        val_p += 1
        if p == all[i]:
            break
    for i in range(len(all)):
        val_q += 1
        if q == all[i]:
            break

    return val_p, val_q

def main():
    n = int(input())
    p = [int(i) for i in input().split()]
    q = [int(i) for i in input().split()]
    all = []

    all = AllPatern(n, all)
    val_p, val_q = WhichNumber(p, q, all)
    print(abs(val_p - val_q))



if __name__ == '__main__':
    main()
N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			ans.append(arr.pop(idx2-1))
			break
		elif idx2 == 1:
			print(-1)
            exit()

for idx in range(0, N):
	print(ans.pop(-1))
  	print("\n")


### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			tmp = arr.pop(idx2-1)
			ans.append(tmp)
			break
		elif idx2 == 1:
			print(-1)
			exit()

for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)
n,h,w = map(int,input(),split())
print((n-h+1)*(n-w+1))

### FIXED CODE ###

n = int(input())
h = int(input())
w = int(input())
print((n-h+1)*(n-w+1))
import numpy as np

n, m = map(int, input().split())

a = []

for i in range(m):
    a.append(int(input()))
a.append(n)


def fib_memo(n):
    """メモ化フィボナッチ"""
    memo = [0] * (n + 1)

    def _fib(n):
        if n <= 1:
            return n
        if memo[n] != 0:
            return memo[n]
        memo[n] = _fib(n - 1) + _fib(n - 2)
        return memo[n]

    return _fib(n)


for i in range(1, len(a)):
    sa = a[i] - a[i - 1]
    if sa == 1:
        print("0")
        exit()

a2 = []
for i in range(len(a)):
    if i == 0:
        a2.append(fib_memo(a[i]))
    elif i == (len(a) - 1):
        a2.append(fib_memo(a[i] - a[i - 1]))
    else:
        a2.append(fib_memo(a[i] - a[i - 1]) - 1)

print(np.prod(a2) % 1000000007)


### FIXED CODE ###

n, m = map(int, input().split())
A = set()
for i in range(m):
    a = int(input())
    A.add(a)
dp = [0] * (n + 1)
for i in range(n + 1):
    if i in A:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])

"""
100 5
1
23
45
67
89
"""
S=int(input())

count = 0

l=[]

l = list(S)

a = len(l)

b = a - 1

for i in range(a):
    if l[i] != l[b-i]:
        count = count + 1

count = count/2

print(int(count))

### FIXED CODE ###

S=str(input())

count = 0

l=[]

l = list(S)

a = len(l)

b = a - 1

for i in range(a):
    if l[i] != l[b-i]:
        count = count + 1

count = count/2

print(int(count))
import sys

N,M = map(int,input().split())
SC=[]

ans=0

for i in range(M):
    S,C = map(int,input().split())
    SC.append((S,C))

if N==1:
    if SC[0][1]==0:
        print(0)
        sys.exit()

for i in range(M):
    for j in range(M):
        if SC[i][0]==SC[j][0]:
            if not SC[i][1]==SC[j][1]:
                print(-1)
                sys.exit()
SC=tuple(set(SC))
l=len(SC)

for i in range(l):
    a=SC[i][0]
    b=SC[i][1]
    ans=ans+(10**(N-a))*b

print(ans)

### FIXED CODE ###

import sys

N,M = map(int,input().split())
SC=[]

ans=0

for i in range(M):
    S,C = map(int,input().split())
    SC.append((S,C))

for i in range(M):
    for j in range(M):
        if SC[i][0]==SC[j][0]:
            if not SC[i][1]==SC[j][1]:
                print(-1)
                sys.exit()
    if not N==1:
            if SC[i][0]==1:
                if SC[i][1]==0:
                    print(-1)
                    sys.exit()

if M==0:
    if N==1:
        print(0)
        sys.exit()
    else:
        print(10**(N-1))
        sys.exit()

            
SC=tuple(set(SC))
l=len(SC)

for i in range(l):
    a=SC[i][0]
    b=SC[i][1]
    ans=ans+(10**(N-a))*b
if not N==1:
    if ans<10**(N-1):
        ans=ans+10**(N-1)

print(ans)
import sys
readline = sys.stdin.readline
MOD = 10**9+7
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%MOD
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], MOD -2, MOD)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % MOD
    return frac, fraci

frac, fraci = frac(1341398)
def cmb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%MOD

K, = map(int, input().split())
t = len(input().strip())

R = 0
for x in range(K+1):
    R += cmb(K+t-x-1, t-1)*pow(25, K-x, MOD)*pow(26, x, MOD)%MOD
    R %= MOD
print(R)


### FIXED CODE ###

import sys
readline = sys.stdin.readline
MOD = 10**9+7
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%MOD
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], MOD -2, MOD)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % MOD
    return frac, fraci

frac, fraci = frac(2341398)
def cmb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%MOD

K, = map(int, input().split())
t = len(input().strip())

R = 0
for x in range(K+1):
    R += cmb(K+t-x-1, t-1)*pow(25, K-x, MOD)*pow(26, x, MOD)%MOD
    R %= MOD
print(R)
# 1-index
from sys import stdin
H, N = [int(x) for x in stdin.readline().rstrip().split()]

data = [0]*N

for i in range(N):
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    data[i] = (A, B)
dp = [10**9]*(H+1)
dp[0] = 0

for h in range(0,H+1):
    for a,b in data:
        if h+a >= H:
            dp[H] = min(dp[h]+b,dp[H])
        else:
            dp[h+a] = min(dp[h]+b,dp[h+a])
print(dp[H])

### FIXED CODE ###

from sys import stdin
H,A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
while True:
    H -= A
    ans += 1
    if H <= 0:
        break
print(ans)
class HashTable:
    def __init__(self, size = 1000003):
        self.size = size
        self.hash_table = [None] * size

    def _gen_key(self, val):
        h1 = hash(val) % self.size
        h2 = 1 + (hash(val) % (self.size - 1))
        for i in range(h1, self.size, h2):
            if (self.hash_table[i] == None) or (self.hash_table[i] == val):
                return i

    def insert(self, val):
        key = self._gen_key(val)
        self.hash_table[key] = val

    def search(self, val):
        key = self._gen_key(val)
        if self.hash_table[key]:
            return True
        else:
            return False


import sys

n = int(sys.stdin.readline())

simple_dict = HashTable()

ans = ''

for i in range(n):
    operation = sys.stdin.readline()
    if operation[0] == 'i':
        simple_dict.insert(operation[7:])
    else:
        if simple_dict.search(operation[5:]):
            ans += 'yes'
        else:
            ans += 'no'
        ans += '\n'

print(ans, end = '')

### FIXED CODE ###

class HashTable:
    def __init__(self, size = 1000003):
        self.size = size
        self.hash_table = [None] * size

    def _gen_key(self, val):
        raw_hash_val = hash(val)
        h1 = raw_hash_val % self.size
        h2 = 1 + (raw_hash_val % (self.size - 1))
        for i in range(self.size):
            candidate_key = (h1 + i * h2) % self.size
            if not self.hash_table[candidate_key] or self.hash_table[candidate_key] == val:
                return candidate_key

    def insert(self, val):
        key = self._gen_key(val)
        self.hash_table[key] = val

    def search(self, val):
        key = self._gen_key(val)
        if self.hash_table[key]:
            return True
        else:
            return False


import sys

n = int(sys.stdin.readline())

simple_dict = HashTable()

ans = ''

for i in range(n):
    operation = sys.stdin.readline()
    if operation[0] == 'i':
        simple_dict.insert(operation[7:])
    else:
        if simple_dict.search(operation[5:]):
            ans += 'yes'
        else:
            ans += 'no'
        ans += '\n'

print(ans, end = '')
A, B, C, D = map(input().split())

if A + B > C + D:
    print("Left")
elif A + B == C + D:
    print("Balanced")
else:
    print("Right")


### FIXED CODE ###

A, B, C, D = map(int, input().split())

if A + B > C + D:
    print("Left")
elif A + B == C + D:
    print("Balanced")
else:
    print("Right")
def solve(string):
    h, w, *s = string.split()
    h, w = map(int, [h, w])
    hg = []
    hi = []
    vg = []
    vi = []

    for _s in s:
        gn = 0
        _hi = [0] * w
        _hg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _hi[i] = -1
                gn += 1
                _hg.append(c)
                c = 0
                continue
            _hi[i] = gn
            c += 1
        _hg.append(c)
        hg.append(_hg)
        hi.append(_hi)
    for _s in zip(*s):
        gn = 0
        _vi = [0] * h
        _vg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _vi[i] = -1
                gn += 1
                _vg.append(c)
                c = 0
                continue
            _vi[i] = gn
            c += 1
        _vg.append(c)
        vg.append(_vg)
        vi.append(_vi)
        ans = 0
        for i in range(h):
            ans = max(ans, max([hg[i][hi[i][j]] + vg[j][vi[j][i]]) for j in range(w)])
        return str(ans - 1)


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))


### FIXED CODE ###

def solve(string):
    h, w, *s = string.split()
    h, w = map(int, [h, w])
    hg = []
    hi = []
    vg = []
    vi = []

    for _s in s:
        gn = 0
        _hi = [0] * w
        _hg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _hi[i] = -1
                gn += 1
                _hg.append(c)
                c = 0
                continue
            _hi[i] = gn
            c += 1
        _hg.append(c)
        hg.append(_hg)
        hi.append(_hi)
    for _s in zip(*s):
        gn = 0
        _vi = [0] * h
        _vg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _vi[i] = -1
                gn += 1
                _vg.append(c)
                c = 0
                continue
            _vi[i] = gn
            c += 1
        _vg.append(c)
        vg.append(_vg)
        vi.append(_vi)

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, hg[i][hi[i][j]] + vg[j][vi[j][i]])
    return str(ans - 1)


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

l = map(int, raw_input().split())
A = map(int, raw_input().split())

sm = l[2]
la = l[2]
while(True):
    sm = sm - 1
    la = la + 1
    if sm == 0:
        print 0
    if la == l[0]:
        print 0
    if sm in A and la in A:
    	ix = A.index(sm) + A.index(la)
        ix = ix / 2 + 0.5
        break
    if sm in A:
        ix = A.index(sm)
		break
    if la in A:
		ix = A.index(la)
		break
M = l[1] - ix - 1
if M > ix:
    print int(math.ceil(ix))
else:
    print int(math.ceil(M))


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

l = map(int, raw_input().split())
A = map(int, raw_input().split())

sm = l[2]
la = l[2]
while(True):
    if sm == 0:
        print 0
    if la == l[0]:
        print 0
    sm = sm - 1
    la = la + 1
    if sm in A and la in A:
    	ix = A.index(sm) + A.index(la)
        ix = ix / 2 + 0.5
        break
    if sm in A:
        ix = A.index(sm) + 0.5
	break
    if la in A:
	ix = A.index(la) - 0.5
	break
M = l[1] - ix - 1
if M > ix:
    print int(math.ceil(ix))
else:
    print int(math.ceil(M))
s = input()

l = len(s)


def dfs(i):
    #    print("->", s[i:])
    if i == l:
        print("YES")
        exit()
    if s[i:i+5] == "dream":
        if i+7 < l and s[i+5:i+7] == "er":
            dfs(i+7)
        dfs(i+5)
    elif s[i:i+5] == "erase":
        if i+5 < l and s[i+5] == "r":
            dfs(i+6)
        dfs(i+5)


dfs(0)
print("NO")


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

s = input()
l = len(s)


def dfs(i):
   #    print("->", s[i:])
    if i == l:
        print("YES")
        exit()
    if s[i:i+5] == "dream":
        if i+6 < l and s[i+5:i+7] == "er":
            dfs(i+7)
        dfs(i+5)
    elif s[i:i+5] == "erase":
        if i+5 < l and s[i+5] == "r":
            dfs(i+6)
        dfs(i+5)


dfs(0)
print("NO")
N, K = map(int, input().split())
h = [0] * N
for i in range(N):
    h[i] = int(input())
h.sort()
print(min(h[i+K-1]-h[i] for i in range(N)))


### FIXED CODE ###

N, K = map(int, input().split())
h = [0] * N
for i in range(N):
    h[i] = int(input())
h.sort()
print(min(h[i+K-1]-h[i] for i in range(N-K+1)))
n = int(input())
 
before_reverse_num = 0
for _ in range(n):
  before_reverse_num += 1.0 / int(input())
after_reverse_num = 1.0 / before_reverse_num
print(str(round(after_reverse_num,5)))

### FIXED CODE ###

n = int(input())
values = input().split()
before_reverse_num = 0
for _ in range(n):
  before_reverse_num += 1 / int(values[_])
after_reverse_num = 1 / before_reverse_num
print(str(round(after_reverse_num,5)))
A,B = map(int,input().split())
return A+B % 24

### FIXED CODE ###

A,B = map(int,input().split())
print((A+B) % 24)
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def com(com_n, com_r):
    return fac[com_n] * inv[com_r] * inv[com_n - com_r] % md
def way(h, w):
    if h < 0 or w < 0:
        return 0
    else:
        return com(h + w, h)

# combinationの準備
# md>n_maxの条件
md = 10 ** 9 + 7
n_max = 100
fac = [1]
inv = [1] * (n_max + 1)
k_fac_inv = 1
for i in range(1, n_max + 1):
    k_fac_inv = k_fac_inv * i % md
    fac.append(k_fac_inv)
k_fac_inv = pow(k_fac_inv, md - 2, md)
for i in range(n_max, 1, -1):
    inv[i] = k_fac_inv
    k_fac_inv = k_fac_inv * i % md

def main():
    h, w, n = MI()
    rc = [LI1() for _ in range(n)]
    # i番目の壁まで無傷で来る方法の数
    # (全ルート)－(i-1までの壁にぶつかる分)
    rc.sort(key=lambda x: x[0] + x[1])
    dp = [0] * n
    for i, (r, c) in enumerate(rc):
        dp[i] = way(r, c) - sum(v * way(r - pr, c - pc) % md for v, (pr, pc) in zip(dp[:i], rc[:i]))
        dp[i] %= md
    h, w = h - 1, w - 1
    ans = way(h, w) - sum(v * way(h - r, w - c) % md for v, (r, c) in zip(dp, rc))
    print(ans % md)

main()


### FIXED CODE ###

def f():
    h, w, n = map(int, input().split())
    md = 10 ** 9 + 7
    k = [list(map(int, input().split())) for _ in range(n)] + [[h, w]]

    # 壁をマンハッタン距離順に
    k.sort(key=lambda x: x[0] + x[1])

    # 階乗と逆元とコンビネーションを事前準備
    fct = [1]
    re_fct = []
    fct_i = 1
    for i in range(1, h + w + 1):
        fct_i = fct_i * i % md
        fct += [fct_i]
    # fct_i**(md-2)が逆元re_i
    re_i = 1
    p = md - 2
    while p:
        if p & 1:
            re_i = re_i * fct_i % md
        p >>= 1
        fct_i = fct_i ** 2 % md
    for i in range(h + w, -1, -1):
        re_fct += [re_i]
        re_i = re_i * i % md
    re_fct = re_fct[::-1]
    cmb = lambda a, b: fct[a] * re_fct[b] * re_fct[a - b] % md

    # こっから本体
    dp = [0] * (n + 1)
    for i, [r, c] in enumerate(k):
        dpi = cmb(r + c - 2, r - 1) % md
        for j in range(i):
            dr, dc = r - k[j][0], c - k[j][1]
            if dr >= 0 and dc >= 0:
                dpi = (dpi - dp[j] * cmb(dr + dc, dr)) % md
        dp[i] = dpi
    print(dp[-1])


f()
import bisect
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(index):
  if index == N:
    ans.append(-1)
    return
  num = a[index]
  if len(data[num]) == 1:
    ans.append(index)
    tami(index+1)
  elif index == data[num][-1]:
    ans.append(index)
    tami(data[num][0] +1)
  else:
    tmp = bisect.bisect_right(data[num],index)
    #print(num,data[num],tmp)
    tami(data[num][tmp]+1)

N,K = IL()
a = IL()

data = [[] for i in range(N+1)]
ans = []

for i in range(N):
  data[a[i]].append(i)

#print(data)

tami(0)

#print(ans)
#print(len(ans),K)
#print(K%len(ans))

if K%len(ans) == 0:
  print()
else:
  x = ans[K%len(ans)-1]
  d = []
  d.append(a[x])
  while x != N-1:
    x += 1
    if len(data[a[x]]) == 1:
      d.append(a[x])
    elif x == data[a[x]][-1]:
      d.append(a[x])
    else:
      tmp = bisect.bisect_right(data[a[x]],x)
      x = data[a[x]][tmp]

  print(" ".join(map(str,d)))

"""
for i in range(K):
  for j in range(N):
    if a[j] in data:
      num = data.index(a[j])
      data = data[:num]
    else:
      data.append(a[j])
  print(data)

11 10
1 2 3 0 4 5 6 0 4 5 6

11 10
3 1 4 1 5 9 2 6 5 3 5

10 10
1 4 8 3 5 4 2 3 4 6
"""

### FIXED CODE ###

import bisect
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(index):
  if index == N:
    ans.append(-1)
    return
  num = a[index]
  if len(data[num]) == 1:
    ans.append(index)
    tami(index+1)
  elif index == data[num][-1]:
    ans.append(index)
    tami(data[num][0]+1)
  else:
    tmp = bisect.bisect_left(data[num],index)
    #print(num,data[num],tmp)
    tami(data[num][tmp+1]+1)

N,K = IL()
a = IL()

data = [[] for i in range(200010)]
ans = []

for i in range(N):
  data[a[i]].append(i)

#print(data)

tami(0)

#print(ans)
#print(len(ans),K)
#print(K%len(ans))

if K%len(ans) == 0:
  print()
else:
  x = ans[K%len(ans)-1]
  d = []
  d.append(a[x])
  while x != N-1:
    x += 1
    if len(data[a[x]]) == 1:
      d.append(a[x])
    elif x == data[a[x]][-1]:
      d.append(a[x])
    else:
      tmp = bisect.bisect_left(data[a[x]],x)
      x = data[a[x]][tmp+1]

  print(" ".join(map(str,d)))

"""
for i in range(K):
  for j in range(N):
    if a[j] in data:
      num = data.index(a[j])
      data = data[:num]
    else:
      data.append(a[j])
  print(data)

11 10
1 2 3 0 4 5 6 0 4 5 6

11 10
3 1 4 1 5 9 2 6 5 3 5

10 10
1 4 8 3 5 4 2 3 4 6
"""