Badges are scanned one at a time, left to right. Maintain a running count of how many times each badge value has been seen so far. Report the 0-indexed position of the scan at which some value's running count first reaches exactly k. If no value ever reaches k occurrences, report -1.
Input format
Line 1: two integers n and k.
Line 2: n space-separated integers, the badge values in scan order.
Output format
A single integer: the 0-indexed position of the scan at which a running count first equals k, or -1.
Constraints
- 1 <= n <= 40
- 1 <= k <= 40
- 1 <= each badge value <= 1000000