# Passing Marks CodeChef Solution

### We Are Discuss About 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.