163922025-04-29 11:55:27algoproFasor (40)pypy3Runtime error 20/4078ms32000 KiB
# UUID: ec135883-3569-402f-aba8-3fcf36b86134
def solve():
    n, k = map(int, input().split())
    heights = list(map(int, input().split()))

    for i in range(n):
        taller_found = False
        for j in range(max(0, i - k), min(n, i + k + 1)):
            if i != j and abs(i - j) <= k and heights[j] > heights[i]:
                taller_found = True
                break
        if not taller_found:
            print(i + 1)
            return

if __name__ == "__main__":
    solve()
"""    
N,K=[int(x) for x in input().split()]
A= input().split()

res=0
done = False
while not done:
    for i in range(1,K+1):
        if res+i<N:
            if int(A[res])<int(A[res+i]):
                res+=i
                i=-1
                break
        else:
            done=True
            break
    if i==K:
        done=True

print(res+1)
"""
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/043ms19400 KiB
2Accepted0/048ms21428 KiB
3Accepted2/239ms19404 KiB
4Accepted2/243ms19304 KiB
5Accepted2/246ms19436 KiB
6Accepted2/239ms19444 KiB
7Accepted2/243ms19888 KiB
8Accepted2/248ms21384 KiB
9Accepted2/254ms21508 KiB
10Accepted2/252ms21312 KiB
11Accepted2/257ms22212 KiB
12Accepted2/246ms21416 KiB
13Runtime error0/268ms32000 KiB
14Runtime error0/278ms32000 KiB
15Runtime error0/271ms32000 KiB
16Runtime error0/261ms32000 KiB
17Runtime error0/261ms32000 KiB
18Runtime error0/261ms32000 KiB
19Runtime error0/270ms32000 KiB
20Runtime error0/275ms32000 KiB
21Runtime error0/268ms32000 KiB
22Runtime error0/259ms32000 KiB