Failure in a particular test case

if we have given values of m and n such as 4 5
and array 10 20 30 40 90
but using the above approach we will not be able to get it

what will we not able to get

usually the array size is greater than total no of students so u do not have to worry about this case

in case of doubt share ur code