General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
92182093 Practice:
newlord
222A - 32 Python 3 Wrong answer on test 7 434 ms 6948 KB 2020-09-08 08:04:12 2020-09-08 08:04:12
→ Source
n,k = map(int,input().split())
arr= list(map(int,input().split()))
ans = k-1
flag = 0
for i in range(k-1,n-1):
    if arr[i]!=arr[i+1]:
        flag = 1
        break
arr.sort()
if arr[0]==arr[-1]:
    print(0)
    quit()
if flag == 1:
    print(-1)
else:
    print(ans)
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details