IDENTIFICATION                    DIVISION.
PROGRAM-ID.                       PROGRAM_ID.
DATA                              DIVISION.
WORKING-STORAGE                   SECTION.
01 LN           PIC X(100).
01 IN-D.
    03 D1       PIC X(10).
    03 D2       PIC X(10).
01 IN-L.
    03 L1       PIC 9(2).
    03 L2       PIC 9(2).
01 N            PIC 9(10).
01 K            PIC 9(2).
01 cnt          PIC 9(2).
01 ans          PIC Z9.

PROCEDURE                         DIVISION.
    ACCEPT LN.
    UNSTRING LN DELIMITED BY ALL SPACE
        INTO D1 COUNT IN L1
             D2 COUNT IN L2.
    MOVE D1(1:L1) TO N.
    MOVE D2(1:L2) TO K.
    MOVE 1 TO cnt.
    PERFORM UNTIL N < K ** cnt
        ADD 1 TO cnt
    END-PERFORM.
    MOVE cnt TO ans.
    DISPLAY ans.
    STOP RUN.
