# Shortest 11 Problem 110

## GreaterOrEqual

```Greater or Equal

Alice and Bob decided to play a game of (Greater or Equal).
(Greater or Equal) is a game where Alice thinks of list of integers and some number K.
Bob have to find some number X greater than 0 where exactly K elements in that list are greater than or equal to the number X.
If there are multiple such values return the smallest possible.
If there is no such X, return (-1).

Input parameters:
list - an array of integers
K - integer that represents exactly how many elements in the list should be greater or equal to X

Constraints:
list - List can have between 1 and (100) elements, and each element will be between 1 and (100 000) (inclusive)
K – will be between 0 and (the length of the list) (inclusive)

Return:
An Integer value that represents the minimum possible X, or (-1) if there is no such value X
Class Name:
GreaterOrEqual

Method signature:
public int getMinimumX(int[] list, int k)

Test Case 1:
getMinimumX({3,8,5,1,10,3,20,24}, 2) = 11

Test Case 2:
getMinimumX({4,1,3,4,5}, 0) = 6

Test Case 3:
getMinimumX({99999, 10, 2000, 24}, 0) = 100000

Test Case 4:
getMinimumX({83066,71866,70910,35075,32511,70010}, 0) = 83067

Test Case 5:
getMinimumX({85149,68639,48788,1421,38277,87408,31811,41759}, 3) = 48789

Test Case 6:
getMinimumX({74360,89934,27913,34887,72343,72443,35819,75254}, 0) = 89935

Test Case 7:
getMinimumX({48105,1852,263,9427,4896,3022,71491,74461,15250,25154,79658,40923,15747,99891,93889,82694,14767,88440,86597}, 10) = 25155

Test Case 8:
getMinimumX({85754,32136,47720}, 2) = 32137

Test Case 9:
getMinimumX({20,10,20,24,25}, 2) = 21

Test Case 10:
getMinimumX({87891,9944}, 2) = 1
```