Fixed the off-one error of the input value k