# Passing Marks CodeChef Solution

### We Are Discuss About CODECHEF SOLUTION

Passing Marks CodeChef Solution

## Passing Marks CodeChef Solution ## Problem

In a class of  students, a class test was held. The ��ℎ student scored �� marks. It is also known that the scores of all students were distinct.

A student passes the test if their score is strictly greater than the passing mark. Given that exactly  students pass in the test, find the maximum value of the passing mark of the test.

### Input Format

• The first line of input will contain a single integer , denoting the number of test cases.
• Each test case consists of multiple lines of input.
• The first line of each test case contains two space-separated integers  and  — the number of students in the class and the number of students that passed in the test.
• The next line contains  space-separated integers �1,�2,…,��, where the ��ℎ integer denotes the marks of the ��ℎ student.

### Output Format

For each test case, output on a new line, the maximum value of the passing mark of the test.

### Constraints

• 1≤�≤100
• 1≤�≤100
• 1≤�≤�
• 1≤��≤100
• All elements of array  are distinct.

### Sample 1:

Input

Output

3
2 2
5 1
4 1
5 1 7 4
4 3
15 70 100 31

0
6
30


### Explanation:

Test case 1: Since both students pass the test, both students scored greater than passing marks. The maximum value of passing marks can be 0, as both students have marks greater than 0.

Test case 2: Only one student passes the test. Thus, the third student has passed the test by scoring 7 marks. The passing marks of the test is 6.

Test case 3: Since three students pass the test, students 2,3, and 4 scored greater than passing marks. The maximum value of passing marks can be 30, three students have marks greater than 30. ## SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.