5987 FOR KT=1 TO KN : KST=KM : IF KT>=KM THEN KST=KT