# n = []# c = 0# for i in range(9):# x = int(input())# n.append(x)# max = -1# for j in range(len(n)):# if n[j] > max:# max = n[j]# c = j# print(max)# print(c+1)for i in range(3): a, b, c, d = map(int, input().split()) if a == 0:
# n = []
# c = 0
# for i in range(9):
# x = int(input())
# n.append(x)
# max = -1
# for j in range(len(n)):
# if n[j] > max:
# max = n[j]
# c = j
# print(max)
# print(c+1)
# for i in range(3):
# a = list(map(int, input().split()))
# if a.count(0) == 1:
# print('A')
# elif a. count(0) == 2:
# print('B')
# elif a.count(0) == 3:
# print('C')
# elif a.count(0) == 4:
# print('D')
# else:
# print('E')
# count 함수: a가 몇번 나오는지 계산
x,y = map(int,input().split())
data = list(map(int, input().split()))
max = -999999
for i in range(x+1-y):
if data[i] > max:
max = data[i]