IDENTIFICATION DIVISION.
PROGRAM-ID. 139B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP  PIC X(10).
01 A    PIC 9(2).
01 B    PIC 9(2).
01 I    PIC 9(2).
01 OUT  PIC ZZ9.
*>  
PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ' '
      INTO A B.
*>
  IF (B = 1)
    MOVE 0 TO I
  ELSE
    PERFORM VARYING I FROM 1 BY 1 
      UNTIL (A - 1) * I + 1 >= B
    END-PERFORM
  END-IF.
*>
  MOVE I TO OUT.
  DISPLAY OUT.
*>
  STOP RUN.
