with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Solve is
   N : Integer;
   K : Integer;
begin
   Get (N);
   Get (K);
   if K = 1 then
      Put_Line ("0");
   else
      Put_Line (Integer'Image (N-K));
   end if;
end Solve;