DCB question on today

https://hack.codingblocks.com/app/dcb/888

I am not able to understnd the question and solve

hey,
in this question ,for each input(starting from the Xth you have to sort the existing marks and then print the xth ranked .
for input like

5 2
4 3 5 1 8

your sorted array and their corresponding xth ranked marks will be as follows:

4 3 
Xth:   3
5 4 3 
Xth:   4
5 4 3 1 
Xth:   4
8 5 4 3 1 
Xth:   5

take another test case like:

10 7
10 9 4 3 4 8 2 1 3 6

you get :

10 9 8 4 4 3 2 
Xth:  2
10 9 8 4 4 3 2 1 
Xth:  2
10 9 8 4 4 3 3 2 1 
Xth:  3
10 9 8 6 4 4 3 3 2 1 
Xth:  3

can you help me with its code

share your approach by saving it on ide.codingblocks.com with me and i can help you correct it