Program Task;
Var t: Text;
N, K, M: LongInt;
Begin
Assign(t, 'd:\input.txt');
Reset(t);
While Not EOF(t) Do
Begin
Read(t, N);
Read(t, K);
End;
If (N < 1) Or (N > Exp(100 * Ln(10))) Or (K < 1) Or (K > Exp(9 * Ln(10))) Then
WriteLn('Input error!')
Else
Begin
M := N Mod K;
Assign(t, 'd:\output.txt');
Rewrite(t);
Write(t, M);
Close(t);
Write('Done.');
End;
ReadLn;
End.