problem in javascript solution INTEST is failing

while 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.