Finding K-th output