add the kth to algorithm