CPython lite logoProblemsContests

44. Linear Search #3

 Given n numbers. Write a program that finds the index of the 1 that occurs at the k-th position among these numbers. Indexing starts at 0.


Input

The first line contains 2 natural numbers n and k, (1n105,kn).

The second line contains n numbers separated by spaces ai(1ai105).

Output

A single line with the solution of the problem. If the index does not exist, print 1 .


Sample input 1

3 1
2 1 1

Sample output 1

1

Sample input 2

3 2
2 1 1

Sample output 2

2

Sample input 3

3 3
2 1 1

Sample output 3

-1

Login to be able to submit.

NormalData structuresLoops
191 / 32
Solved / unsolved count
1.0 s / 512 MB
Limits