One day shooshuns found a sequence of *n* integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps:
 1.  Find the number that goes *k*-th in the current sequence and add the same number to the end of the sequence; 1.  Delete the first number of the current sequence. 
The shooshuns wonder after how many operations all numbers on the board will be the same and whether all numbers will ever be the same.
The first line contains two space-separated integers *n* and *k* (1 ≤ *k* ≤ *n* ≤ 10<sup class="upper-index">5</sup>).

The second line contains *n* space-separated integers: *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">5</sup>) — the sequence that the shooshuns found.
# cook your dish here
from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left 
from bisect import bisect_right
 
def L():
    return list(map(int, stdin.readline().split()))
 
def In():
    return map(int, stdin.readline().split())
 
def I():
    return int(stdin.readline())
 
P = 1000000007

def main():
    n, k = In()
    arr = L()
    k -= 1
    i = n-1 
    while (arr[i] == arr[k] and i >= 0):
        i -= 1 
    if i > k:
        print(-1)
    else:
        print(i+1)
if __name__ == '__main__':
    main()
