num1 = int(input("Enter First number:")) num2 = int(input("Enter Second number:")) a = num1 % num2 b = num2 % num1 if a > b: print(b) else: print(a)