Resistor R1 limits input current and reduces ripple of output low voltage. The value of R1 is not critical. Resistor R2 value is not very critical but if it is chosen to be bigger than the calculated value, output high state voltage will drop.