var
a,c:ansistring;
b:ansistring;
i,j,k,sum:longint;
procedure xx(var a:ansistring);
var
i:longint;
c:ansistring;
begin
for i:=1 to length(a) do c:=c+lowercase(a[i]);
a:=c;
end;
begin
assign(input,'stat.in');
reset(input);
assign(output,'stat.out');
rewrite(output);
k:=-1;
readln(a);
readln(b);
xx(a);
xx(b);
for i:=1 to length(b) do
if b[i]=' ' then
begin
if c=a then begin inc(sum); if k=-1 then k:=i-length(a)-1; end;
c:='';
end else
c:=c+b[i];
if sum=0 then writeln(-1)
else writeln(sum,' ',k);
end.