Building Bombing
시간 제한3초메모리 제한1024 MB
건물 L이 왼쪽에서 K번째로 보이는 건물이 되도록 최소 개수의 건물을 폭파하는 문제이다.
문제
KAIST has a series of buildings in a row, numbered from to , from left to right. Building has a height of . Building is visible from the left if and only if every building on its left has a height strictly less than .
Your lab is located in building number . Since your favorite number is , you want to make your lab building the -th tallest building visible from the left. To achieve your goal, you will blow up some of the buildings.
For example, suppose there are buildings in a row and their heights are . Your lab is located at building number and your favorite number is . After blowing up buildings and , the buildings visible from the left will be buildings , , , and . Then your lab becomes the rd tallest building visible from the left, as desired.
What is the minimum number of buildings to blow up to make your lab building the -th tallest building visible from the left?
입력
The first line contains three space-separated integers , , and .
The second line contains space-separated integers .
출력
Output the minimum number of buildings to blow up to make your lab building the -th tallest building visible from the left. If it is impossible to do so, output instead.