problem in javascript solution INTEST

https://www.codechef.com/viewsolution/14340768 is failing

while https://www.codechef.com/viewsolution/14341126 is passing ,

what did i miss?

var len = input.length;

Are you taking len as an input here?? Cause the I/O section of problem says-

The input begins with two positive integers n k (n, k<=107). The next n lines of input contain one positive integer ti, not greater than 109, each.

So there isnt any len in input.

//