A,B=map(int,input().split()) if B<0: A=-A B=-B print(A%B)