const  fp : string = 'puslapiavimas.in';
	   fg : string = 'puslapiavimas.out';
	   
var n, k, i, psl, psl_max, psl_min : integer;
	raid : array['a'..'z'] of boolean;
    c, c2 : char;
    f : text;
    
begin
  assign(f, fp);
  reset(f);
  readln(f, n, k);
  psl := 0;
  psl_max := 0;
  psl_min := maxint;
  fillchar(raid, sizeof(raid), char(false));
  for i:=1 to n do
    begin
      readln(f, c);
      if not raid[c] then
        begin
            raid[c] := true;
            psl := psl + 1;
        end;
      if (i mod k = 0) or (i=n) then
        begin
          if psl_max < psl then
             psl_max := psl;
          if psl_min > psl then
             psl_min := psl;
          psl := 0;
          fillchar(raid, sizeof(raid), char(false));
        end;
    end;
  close(f);

  assign(f, fg);
  rewrite(f);
  WriteLn(f, psl_min);
  WriteLn(f, psl_max);
  close(f);
end.
