# Serence

## 洛谷入门题 - 4

### P1138

n, k = input().split()
k = int(k)
num = input().split()

for i in range(0,len(num)):
num[i] = int(num[i])

num = list(set(num))
num.sort()

if k > len(num) - 1:
print("NO RESULT")
else:
print(num[k-1])


### P1179

a = input().split()
count = 0
s = int(a[0])
e = int(a[1])

for i in range(s,e+1):
index = 0
d = 0
m = str(i)
while d != -1:
d = m.find("2",index)
if d >= 0:
count += 1
index = d + 1

print(count)


### P1150

Peter 有 n 根烟，他每吸完一根烟就把烟蒂保存起来，k(k>1) 个烟蒂可以换一个新的烟，那么 Peter 最终能吸到多少根烟呢？

a = input().split()
n, k = int(a[0]), int(a[1])
temp = n // k
remain = n - temp * k

while temp != 0:
n += temp
remain += temp
temp = remain // k
remain = remain - temp * k

print(n)


### P1151

$sub_1=a_1a_2a_3$
$sub_2=a_2a_3a_4$
$sub_3=a_3a_4a_5$

$sub_1=202$
$sub_2=020 (=20)$
$sub_3=207$

a = int(input())
count = 1

for i in range(10000,30001):
a1 = int(str(i)[0:3])
a2 = int(str(i)[1:4])
a3 = int(str(i)[2:5])
if a1 % a == 0 and a2 % a == 0 and a3 % a == 0:
print(i)
count = 0

if count:
print("No")


### P1152

a = input().split()
n = int(a[0])
del a[0]
test = []

for i in range(0,n):
a[i] = int(a[i])
test.append(i+1)

del test[len(test) - 1]

for i in range(0,n - 1):
temp = abs(a[i + 1] - a[i])
if temp in test:
test[test.index(temp)] = 0

if max(test) > 0:
print("Not jolly")
else:
print("Jolly")


### P1307

s = input()
k = 0

if s[0] == "-":
s = s[1:]
k = 1

s = s[len(s)-1::-1]

while s[0] == "0" and len(s) != 1:
s = s[1:]

if k == 1:
print("-" + s)
else:
print(s)


### P1304

s = int(input())

def isPrime(n):
for i in range(2,n // 2 + 1):
if n % i == 0:
return False
return True

for i in range(4,s+1,2):
for k in range(2, i - 1):
if isPrime(k) and isPrime(i - k):
print(str(i) + "=" + str(k) + "+" + str(i - k))
break


### P1161

s = int(input())
result = []

for i in range(0,2000000):
result.append("0")

for i in range(0,s):
m = input().split()
a = float(m[0])
t = int(m[1])
for k in range(1,t+1):
temp = int(a * k)
if result[temp] == "0":
result[temp] = "1"
else:
result[temp] = "0"

print(result.index("1"))


### P1317

s = int(input())
num = input().split()
count = 0

for i in range(0,s):
num[i] = int(num[i])

for i in range(1,s - 2):
if num[i] >= num[i+1] and num[i+1] <= num[i+2]:
if num[i+1] == num[i+2]:
count -= 1
count += 1

print(count)


### P1319

0001000
0001000
0001111
0001000
0001000
0001000
1111111

a = input().split()
n = int(a[0])
a= a[1:]
temp = 0
count = 0

for i in range(0,len(a)):
a[i] = int(a[i])

while len(a) != 0:
for i in range(0,a[0]):
if count == n:
print("")
count = 0
if temp == 0:
print(0,end="")
count += 1
else:
print(1,end="")
count += 1

if temp == 0:
temp = 1
else:
temp = 0

del a[0]


EOF