var a,b,k: integer;
begin
readln(a,b);
k:=0;
while a>0 do
if a mod 10>b then k:=k+1;
a:=a div 10;
end;
writeln(k);
end.
var a,b,k: integer;
begin
readln(a,b);
k:=0;
while a>0 do
begin
if a mod 10>b then k:=k+1;
a:=a div 10;
end;
writeln(k);
end.