kth element from instance to  function

now use .sort and provied it with args to work