The king's birthday dinner was attended by $$$k$$$ guests. The dinner was quite a success: every person has eaten several dishes (though the number of dishes was the same for every person) and every dish was served alongside with a new set of kitchen utensils.All types of utensils in the kingdom are numbered from $$$1$$$ to $$$100$$$. It is known that every set of utensils is the same and consist of different types of utensils, although every particular type may appear in the set at most once. For example, a valid set of utensils can be composed of one fork, one spoon and one knife.After the dinner was over and the guests were dismissed, the king wondered what minimum possible number of utensils could be stolen. Unfortunately, the king has forgotten how many dishes have been served for every guest but he knows the list of all the utensils left after the dinner. Your task is to find the minimum possible number of stolen utensils.

The first line contains two integer numbers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 100, 1 \le k \le 100$$$)  — the number of kitchen utensils remaining after the dinner and the number of guests correspondingly. The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 100$$$)  — the types of the utensils remaining. Equal values stand for identical utensils while different values stand for different utensils.

Output a single value — the minimum number of utensils that could be stolen by the guests.

NoteIn the first example it is clear that at least one utensil of type $$$3$$$ has been stolen, since there are two guests and only one such utensil. But it is also possible that every person received only one dish and there were only six utensils in total, when every person got a set $$$(1, 2, 3)$$$ of utensils. Therefore, the answer is $$$1$$$.One can show that in the second example at least $$$2$$$ dishes should have been served for every guest, so the number of utensils should be at least $$$24$$$: every set contains $$$4$$$ utensils and every one of the $$$3$$$ guests gets two such sets. Therefore, at least $$$14$$$ objects have been stolen. Please note that utensils of some types (for example, of types $$$2$$$ and $$$4$$$ in this example) may be not present in the set served for dishes.

var n,k,i,c,r,m,g:integer;
    a,b:array [1..100] of integer;
begin
readln(n,k);
for i:=1 to n do
  begin
  read(a[i]);
  c:=a[i];
  b[c]:=b[c]+1;
  end;
m:=0;
r:=0;
for i:=1 to 100 do
  begin
  if b[i]>0 then r:=r+1;
  if b[i]>m then m:=b[i];
  end;
g:=m div k;
if m mod k>0 then g:=g+1;
write(r*g*k-n);
end.

program p1;

var max, n, x, k, i, c, res, kol, koll:integer;
    a:array[1..100] of integer;

begin
  readln(n, k);
  kol:=0;
  for i:=1 to n do begin
    read(x);
    a[x]:=a[x]+1;

    kol:=kol+1;
  end;

  max:=0;
  koll:=0;
  for i:=1 to 100 do begin
    if a[i] <> 0 then koll:=koll+1;
    if a[i] > max then max:=a[i];
  end;

  if max mod k = 0 then
    c:=max div k
  else c:= max div k + 1;

  res:=0;
  res:=c*k*koll - kol;

  writeln(res);
end.

program taskA;
var a:array[1..100]of longint;
n,i,j,k,c,max,b,sleft,smustbe:longint;
begin
 readln(n,k);
 for i:=1 to 100 do a[i]:=0;
 for i:=1 to n do
  begin
   read(c); inc(a[c]);
  end;
 max:=a[1];
 for i:=2 to 100 do
  if max<a[i] then max:=a[i];   {���� ������� �ਡ�஢ ������ ����}
 {������ ���}
 b:=max div k;
 if max mod k<>0 then inc(b);

 smustbe:=0;
 for i:=1 to 100 do
  if a[i]<>0 then
   inc(smustbe,b); {�� ������ ����� ��� ��� ���}
 smustbe:=smustbe*k; {�� ���}

 sleft:=0;
 for i:=1 to 100 do sleft:=sleft+a[i];

 write(smustbe-sleft);

end.

var
   i,c,n,k,t,g,mx: integer;
   a:array[1..100] of integer;
begin
    read(n,k);
    for i:= 1 to 100 do a[i]:=0;
    for i:= 1 to n do
      begin
       read(t);
       a[t]:=a[t]+1;
      end;
    mx:=0;  c:=0;
    for i:= 1 to 100 do
      begin
       if a[i]>mx then mx:=a[i];

       if a[i]<>0 then inc(c)
      end;
    g:=mx div k;
    if (mx mod k > 0) then inc(g);
    write((g*c*k)-n)
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  m, n, k, i, s, k1: integer;
  a, b:array[1..110]of integer;
begin
  readln(n, k);
  for i := 1 to n do
    read(a[i]);
  for i := 1 to 100 do
    b[i] := 0;
  for i := 1 to n do
    inc(b[a[i]]);
  m := 0;
  for i := 1 to 100 do
    if (m < b[i])then m := b[i];
  k1 := 0;
  while (k1 < m)do
   k1 := k1 + k;
   s := 0;
  for i := 1 to 100 do
    if (k1 - b[i]<>k1)then inc(s, k1 - b[i]);
  writeln(s);
  readln;
  readln;
end.

program zA;
var
  n, k: integer;
  aAStr: array of string;
  al: array [1..100] of integer;
  ai: integer;
  nk: array of string;
  nkStr, aStr: string;
  err: integer;
begin
  readln(nkStr);
  nk := nkStr.Split(' ');
  val(nk[0], n, err);
  val(nk[1], k, err);

  readln(aStr);
  aAStr := aStr.Split(' ');
  for var i := 0 to 99 do begin
    if i+1 > length(aAStr) then break;
    val(aAStr[i], ai, err);
    al[ai] := al[ai] + 1;
  end;

  var aMax: integer := 0;
  var pNum: integer := 0;
  for var i := 1 to 100 do begin
    if al[i] > 0 then pNum := pNum + 1;
    if aMax < al[i] then aMax := al[i];
  end;

  var buff: integer := aMax mod k;
  var blNum: integer := aMax div k;
  if buff > 0 then blNum := blNum + 1;
  writeln((blNum*k*pNum)-n);
end.

program _1;

var
  i, k, n, m, o: integer;
  mas, mos: array[1..100] of integer;

begin
  m := 0;
  readln(n, k);
  for i := 1 to n do read(mas[i]);
  for i := 1 to n do mos[mas[i]]+=1;
  for i := 1 to 100 do
  begin
    if m < mos[i] then m := mos[i];
    if mos[i] <> 0 then o := o + 1;
  end;
  while m mod k <> 0 do m:=m+1;
  writeln(m*o-n);
end.

var a,b:array[1..100000] of longint;
maX,i,n,m,k,l,j,x,ans:longint;

begin
readln(n,k);
for i:=1 to n do begin read(a[i]); inc(b[a[i]]); end;
max:=0;
for i:=1 to 100 do begin
if (b[i] div k>max) and (b[i] mod k<>0) then max:=b[i] div k;
if (b[i] div k>max) and (b[i] mod k=0) then max:=(b[i] div k)-1; end;

max:=max+1;
for i:=1 to 100 do if b[i]>0 then ans:=ans+k*max-b[i];
writeln(ans);

end.

program stolovaya;
  var mas:Array [1..100] of integer;
  var n, k, i, max, sperli, unique_pribor, j, tmp, count:integer;
begin
  read(n, k);
  for i:=1 to n do read(mas[i]);
  max:=0;
  unique_pribor:=0;
  for i:=1 to 100 do begin
    tmp:=0;
    for j:=1 to n do begin
      if i = mas[j] then tmp:=tmp + 1;
    end;
    if tmp>max then max:=tmp;
    if tmp > 0 then unique_pribor:=unique_pribor + 1;
  end;
  if (max mod k) = 0 then count:=max div k
  else count:=(max div k) + 1;
  sperli:=count * unique_pribor * k;
  write(sperli - n);
end.

program ideone;
var n,k,count,max,i,j,l: integer;
var a:array [1..100] of integer;
begin
    max:=0;
    for i:=1 to 100 do
    a[i]:=0;
	readln (n,k);
	for i:=1 to n do
	begin
	read (l);
	a[l]:=a[l]+1;
    end;
    for i:=1 to 100 do
	begin
	if max<a[i] then
	max:=a[i];
    end;
    j:=((max-1) div k) + 1;
    count:=0;
    for i:=1 to 100 do
    begin
    if a[i]<>0 then
    count:=count+ j*k-a[i];
    end;
    writeln(count);
end.

program zadachaA;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i: integer;
  max, k, n, p, sum, mult: int64;
  a: array[1..150] of integer;
begin
  readln(n, k);
  max := -1;
  for i := 1 to n do begin
    read(p);
    inc(a[p]);
    if (p > max) then
      max := p;
  end;
  p := 0;
  mult := 1;
  for i := 1 to max do
    if (a[i] <> 0) then begin
      if (a[i] > k) then
        if (a[i] mod k <> 0) then
          if ((a[i] div k) + 1 > mult) then
            mult := a[i] div k + 1;
      if (a[i] > k) then
        if (a[i] mod k = 0) then
          if (a[i] div k > mult) then
            mult := a[i] div k;
      inc(p);
    end;
  writeln(p * k * mult - n);
  readln;
  readln;
end.

program project1;
var  n,k,i,prib,propalo,maxprib1vid:integer;
  mas:array[1..101] of integer;
begin
 for i:=1 to 101 do
 mas[i]:=0;
  propalo:=0;
 maxprib1vid:=0;
 readln(n,k);

 for i:=1 to n do begin
read(prib);
 mas[prib]:= mas[prib]+1;
 if mas[prib]>maxprib1vid then maxprib1vid:=mas[prib]
 end;
 if (maxprib1vid mod k<>0) then
 maxprib1vid:=maxprib1vid-(maxprib1vid mod k)+k;
 for i:=1 to 101 do
 if mas[i]<>0 then propalo:=propalo+maxprib1vid-mas[i];
 write(propalo);
 // readln();

end.

var a,b,l,k,i,z,s,max:integer; m:array [1..100] of integer;

begin
s:=0;
readln(a,b);
for i:=1 to a do begin
read(z);
m[z]:=m[z]+1;
end;
max:=0;
for i:=1 to 100 do begin
if m[i]>max then
max:=m[i];
end;
if max<b then begin
k:=1;
end
else
if max mod b = 0 then begin
k:= max div b;
end
else
begin
k:=max div b +1;
end;
l:=b*k;
for i:=1 to 100 do begin
if m[i]<>0 then begin
s:=s+l-m[i];
end;
end;
writeln(s);
end.

program one;

var
  m, n1: array[1..100] of integer;
  i, n, k, q, x, y, l: integer;

begin
  Readln(n, k);
  x := 0;
  y := k;
  for i := 1 to n do
  begin
    Read(n1[i]);
    q := n1[i];
    m[q] := m[q] + 1;
  end;
  repeat
    l := 0;
    for i := 1 to 100 do
    begin
      if m[i] > k then begin
        k := k + y;
        l := 1;
      end;
    end;
  until(l = 0);
  for i := 1 to 100 do
  begin
    if m[i] = 0 then m[i] := 101;
  end;
  for i := 1 to 100 do
  begin
    if (m[i] <> 101) then begin
      if m[i] <> k then x := x + (k - m[i]);
    end;
  end;
  Writeln(x);
end.

                           const eps=0.0000000001;  besk1=200000008;  nnn=4600000;
              modul=1000000007{998244353} ;
   besk=4000000000000000000;
   label 22,1,2,3,4;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    var dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,zz,jjj,l,r,aa,bb,cc,sum,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,kol,sq,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,ll,rr,posx,posy,gr,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,t2,t1,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,t,nm,smin,cen:int64;
   k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   kolpr,x1,x0,d,xx,yy,b,a,zsum,y,x,z:array[-200000..535002] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;
    v,ans,ccc,dist,alpha,phi:extended;
    koef,polex,poley,dd:array[-1..240,-1..213,-1..203] of int64;
    ppos,mma,ma:array[-1000..2000005,-1..15] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,num,y1,z1,z2,kolnul,fact,next,prev,str,s,name,dnew, voltay,c,day:mas;
    zzz:array[0..125000000] of byte;
    aaa,bbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    ddd,ppole,ddl,ddr,dd3,dd4:array[-10..200,-10..220] of int64;
    ddnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..200005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    pr,hesh,numright,dr: array [-10..206000,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

    grr :array [-10..2010,-10..2010] of boolean;
    maxpr:array[0..nnn] of string;
    sss:array[-10..nnn] of string;
     tx,ty,vel,ott,v0,v1,s0,t0:int64;
     zv:point;
     left,right,ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     mash,sqx,sqy,ottt:extended;
     xxxx,yyyy,yot:double;
       flag2,flag,flag1:boolean;

  function max(a,b:int64):int64;
begin max:=a; if b>a then max:=b;   end;

  function min(a,b:int64):int64;
begin min:=a; if b<a then min:=b;   end;

procedure udal(p:longint);
begin  next[prev[p]]:=next[p]; prev[next[p]]:=prev[p]; end;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

function prost(tt:int64):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then fl:=false;

   prost:=fl;
 end;

function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

function gl(ch:char):boolean;
begin
 if (ch='o')or (ch='a')or(ch='e')or(ch='u')or(ch='i') then gl:=true else gl:=false;

end;

function zaprmax(left,right:longint):int64;
begin
   if left>=right then zaprmax:=y[left] else
     begin
        if not odd(left) and odd(right) then zaprmax:=zaprmax(left shr 1,right shr 1) else
         begin
          if odd(left) then zaprmax:=max(zaprmax(left+1,right),y[left]);
          if not odd(right) then zaprmax:=max(zaprmax(left,right-1),y[right]);

         end;

     end;

end;

 function ff(gr:int64):boolean;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=m;  cc:=aa; fl:=false;
  while abs(aa-bb)>1 do
    begin
       cc:=(aa+bb) shr 1;
       if y[cc]<gr then aa:=cc else bb:=cc;

    end;
  { writeln(' cc= ',cc);
  } cc:=min(cc+3,m+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
  ff:=fl;
end;

begin
   { assign (input,'D:\Projects\input.txt');reset(input);
      assign (output,'D:\Projects\output.txt'); rewrite(output);
    }

      read(n,k);
    for i:=1 to n do read(a[i]);
    for i:=1 to n do inc(x[a[i]]);
    for i:=0 to 10000 do p:=max(p,x[i]);
    for i:=0 to 1000 do if x[i]>0 then inc(pp);

    t:=(p+k-1) div k;
  {  writeln('p= ',p,' t= ',t);
  }  writeln(t*k*pp-n);

1:             close(output);
end.

program qq;
var k,n,a,b,c,f,d,i,max,e:longint;
    ki:array[1..100] of integer;
begin
readln(n,k);
For i:=1 to n do begin
 read(b);
ki[b]:=ki[b]+1;
end;
max:=0;
For i:=1 to 100 do
 if (ki[i]>max) then max:=ki[i];

for i:=0 to 100 do
if ( (max+i) mod k=0) then begin
 max:=(max+i) div k;
 break;
end;
c:=0;
e:=0;
For i:=1 to 100 do begin
if(ki[i]<>0) then
e:=e+1;
end;
writeln(max*k*e-n);
end.

var
  arr: array[1..100] of longint;
  k, n, i, ch, kolv, max: longint;

begin
  read(k, n);
  for i := 1 to k do
  begin
    read(ch);
    if arr[ch] = 0 then kolv := kolv + 1;
    arr[ch] := arr[ch] + 1;
  end;
  for i := 1 to 100 do
    if max < arr[i] then max := arr[i];
  if max mod n = 0 then write((max div n) * kolv * n - k)
  else write(((max div n) + 1) * kolv * n - k);
end.

var
 k, n, m, max, now, ans, i: longint;
 v: array[0..100] of longint;
procedure qSort(l,r:longint);
var i,j, w, q:longint;
begin
  i := l; j := r;
  q := v[(l+r) div 2];
  repeat
    while (v[i] < q) do inc(i);
    while (q < v[j]) do dec(j);
    if (i <= j) then
    begin
      w:=v[i]; v[i]:=v[j]; v[j]:=w;
      inc(i); dec(j);
    end;
  until (i > j);
  if (l < j) then qSort(l,j);
  if (i < r) then qSort(i,r);
end;

begin
  readln(n, k);
  for i:=1 to n do
    read(v[i]);
  qSort(1, n);
  max:=1;
  now:=1;
  for i:=2 to n do
  begin
   if v[i]=v[i-1] then inc(now);
   if now > max then max := now;
   if v[i] <> v[i-1] then now := 1;
  end;

  while max mod k <> 0 do
  begin
    inc(max);
  end;

        ans := 0;
  v[0]:=999;
  v[n+1]:=999;
  now := 1;
  for i:=1 to n+1 do
  begin
    if v[i] = v[i-1] then inc(now)
   else if i <> 1 then begin inc(ans, max - now); now := 1; end;
  end;

  writeln(ans);
  readln;
end.

var c,max,x,i,n,k:integer; a:array[1..100] of integer;
begin
readln(n,k);
for i:=1 to n do
begin
read(x);
inc(a[x]);
end;
for i:=1 to 100 do
begin
if a[i]>max then max:=a[i];
if a[i]<>0 then inc(c);
end;
if (max mod k)=0 then write(c*max-n) else
write(c*(  ((max div k)+1)*k  )-n)
end.

var
a:array[1..100]of integer;
i,n,k,q,max,z,x:integer;
begin
readln(n,k);
for i:=1 to n do begin
read(q);
a[q]:=a[q]+1;
if a[q]> max then max:=a[q];
end;

if max mod k >0 then x:=1;
max:=(max div k)*k+x*k;

for i:=1 to 100 do if a[i]>0 then z:=z+(max-a[i]);

writeln(z);
end.

program abc;
var n,a,k,s,i,mn:integer;
      m:array[1..1000] of integer;
begin
s:=0; mn:=1;
read(n);
read(k);
for i:=1 to n do
  begin
    read(a);
    inc(m[a]);
    if m[a]>(k*mn) then inc(mn);
  end;
for i:=1 to 1000 do
  if m[i]<>0 then
    s:=s+(k*mn-m[i]);
writeln(s);
end.

var a:array of int64;
    b: array [1..100] of int64;
    k,n,z,j,max:int64;

begin
read(k,n);
setlength(a,k);
for var i:=0 to k-1 do
begin
read(a[i]);
b[a[i]]+=1;
end;
max:=1;
for var i:=1 to 100 do if b[i]>max then max:=b[i];
if max mod n =0 then j:=max div n else j:=(max div n)+1;
for var i:=1 to 100 do
begin
if b[i]<>0 then z+= n*j-b[i];
end;
write(z);
end.

var
  x: array of int64;
  y: array [1..100] of int64;
  k, n, s, v, maximum,i,f,p: integer;
  trueorfalse:boolean;
begin
  read(k, n);
  setlength(x, k);
  trueorfalse:=true;
  for i := 0 to k - 1 do
  begin
    read(x[i]);
    y[x[i]] += 1;
  end;
  maximum := 1;
  for f := 1 to 100 do
    if y[f] > maximum then
      maximum := y[f];
  if maximum mod n = 0 then
    v := maximum div n
  else v := (maximum div n) + 1;
  for p := 1 to 100 do
  begin
    if y[p] <> 0 then s += n * v - y[p];
  end;
  if trueorfalse=true then
  write(s)
  else
  write('ErRoR');
end.

var n,k,i,c,r,m,g:integer;
    a,b:array [1..100] of integer;
begin
readln(n,k);
for i:=1 to n do
  begin
  read(a[i]);
  c:=a[i];
  b[c]:=b[c]+1;
  end;
m:=0;
r:=0;
for i:=1 to 100 do
  begin
  if b[i]>0 then r:=r+1;
  if b[i]>m then m:=b[i];
  end;
g:=m div k;
if m mod k>0 then g:=g+1;
write(r*g*k-n);
end.

var
   a:array[1..100] of integer;
   n,k,i,l,b,d:integer;
begin
   readln(n,k);
   b:=0;
   for i:=1 to 100 do
   a[i]:=0;
   for i:=1 to n do
   begin
      read(l);
      inc(a[l]);
   end;
   l:=0;
   for i:=1 to 100 do
   begin
      if a[i]>l then l:=a[i];
      if a[i]<>0 then inc(b);
   end;
   l:=(l-1) div k + 1;
   writeln(l*b*k-n)
end.

program agfd;
var t:array[1..100] of integer;
    i, n, k, p, max:integer;
begin
  readln(n, k);
  for i:=1 to n do begin
    read(p);
    t[p]:=t[p]+1;
    if t[p] > max then max:=t[p];
  end;
  if max mod k <> 0 then max:=max+(k - (max mod k));
  p:=0;
  for i:=1 to 100 do begin
    if (t[i] < max) and (t[i] <> 0) then p:=p+(max-t[i]);
  end;
  writeln(p);
end.

program stolowaya ;

var
  a1: array of int64;
  a2: array [1..100] of int64;
  b1, b2, b3, b4, max, q: int64;
   x1,x2 : real ;

begin
  read(b1, b2);
  setlength(a1, b1);
  for q:=1 to 100 do
  begin
  x1:=sqr(x1)*sqr(x2) ;
  x2:=sqrt(x1) ;
  end;

  for var i := 0 to b1 - 1 do
  begin
    read(a1[i]);
    a2[a1[i]] += 1;
  end;
  max := 1;
  for var i := 1 to 100 do if a2[i] > max then max := a2[i];
  if max mod b2 = 0 then b4 := max div b2 else b4 := (max div b2) + 1;
  for var i := 1 to 100 do
  begin
    if a2[i] <> 0 then b3 += b2 * b4 - a2[i];
  end;
  write(b3);
end.

const maxn=1000;
var a : array[1..maxn] of longint;
    n,k,i,j,x,max,ans,d,kol:longint;

begin
    readln(n, k);
    for i:=1 to n do
        read(a[i]);
    for i:=1 to n-1 do
        for j:=i+1 to n do
            if a[i] > a[j] then begin
                x:=a[i];
                a[i]:=a[j];
                a[j]:=x;
            end;
    d:=1;
    for i:=1 to n do
        if a[i] = a[i+1] then inc(d) else begin
            if d > max then max:=d;
            d:=1;
        end;
    kol:=max div k;
    if max mod k > 0 then inc(kol);
    d:=1;
    for i:=1 to n do
        if a[i] = a[i+1] then inc(d) else begin
            inc(ans, kol*k-d);
            d:=1;
        end;
    writeln(ans);
end.

var a:array[1..100] of integer;
n,k,i,d,max,l,s:integer;
begin
max:=0;
readln (n,k);

for i:=1 to 100 do
a[i]:=0;
for i:=1 to n do
begin
read (d);
a[d]:=a[d]+1;
end;
s:=0; d:=0;
for i:=1 to 100 do
begin
if a[i]>max then max:=a[i];
if a[i]>0 then d:=d+1;
end;

if max mod k=0 then l:= max div k else l:= (max div k)+1;
s:=l*d*k-n;
writeln(s);
end.

var
a,b:array [1..1000] of longint;
max,n,k,kol,i:longint;
begin
max:=0;
readln(n,k);
for i:=1 to n do
begin
read(a[i]);
b[a[i]]:=b[a[i]]+1;
if max<b[a[i]] then max:=b[a[i]];
end;
kol:=0;
for i:=1 to 100 do
if b[i]<>0 then kol:=kol+1;
if max mod k =0 then begin writeln(max * kol -n); halt; end;
if max mod k <>0 then begin writeln((max div k + 1) * kol*k  -n); halt; end;
end.

Var n,k,l,max,h,i,g,x,m,b:integer;
    a:array[1..100] of integer;

Begin
readln(n,k);
for i:=1 to n do
read(a[i]);
h:=1;
While h<=100 do
begin
for i:=h to n do
 begin
 if a[h]=a[i] then begin l:=l+1  end;
 end;
if l>max then max:=l;
h:=h+1;
l:=0;
end;

if max mod k > 0 then g:=(max div k) + 1  else g:=(max div k);
h:=1;
for h:=1 to 100 do
begin
for i:=1 to n do
    begin
    if a[i]=h then begin m:=m+1; break; end;
    end;
end;

x:=(m*k*g) - n;
writeln(x);
end.

program x;
var
a, n, k, i, col, m, e, max:integer;
b:array[1..100] of integer;
c:array[1..100] of integer;
begin
max:=0;
read(n, k);
for i:=1 to n do
  read(b[i]);
for i:=1 to n do
begin
  for e:=1 to 100do
    if(b[i]=e) then c[e]:=c[e]+1;
end;
for i:=1 to 100 do
begin
  if(c[i]<>0) then col:=col+1;
  if(c[i]>max) then max:=c[i];
end;

if(max/k > max div k) then m:= (max div k) + 1
else m:= max div k;
//writeln(col);
//writeln(m);
//writeln(k);
writeln(col*m*k-n);

end.

var A: array [1..100] of byte;
n,k,i,p,t,x: byte;
begin
read(n,k);
for i:= 1 to 100 do
 A[i]:=0;
p:=0;
t:=0;
for i:= 1 to n do begin
 read(x);
 A[x]:=A[x]+1 end;
for i:=1 to 100 do begin
 if A[i]>p then p:=A[i];
 if A[i]>0 then t:=t+1 end;
if p mod k = 0 then p:=p div k
 else p:=p div k +1;
writeln(p*k*t - n);
end.

var a,n,k,m,max,h:integer;
b:array [1..100] of integer;

begin
readln(n,k);
for var i:=1 to n do
begin
read(a);
b[a]:=b[a]+1;
if b[a]=1 then
m:=m+1;
if b[a]>max then
max:=b[a];
end;
if max mod k>0 then
h:=(max div k)+1
else h:=(max div k);
writeln(h*k*m-n);
end.

var i,j,n,k,ans,mx,x,n1:integer;
a:array[1..100] of integer;
begin
for i:=1 to 100 do
a[i]:=0;
read (n);
read(k);
for i:=1 to n do
begin
read (x);
a[x]:=a[x]+1;
end;
mx:=0;
n1:=0;
for i:=1 to 100 do
begin
if a[i]>mx then
mx:=a[i];
if a[i]>0 then
n1:=n1+1;
end;
ans:=(mx+k-1) div k;
ans:=(ans*n1*k)-n;
writeln (ans);
end.

var
a:array[1..100]of integer;
i,n,k,q,max,z,x:integer;
begin
readln(n,k);
for i:=1 to n do begin
read(q);
a[q]:=a[q]+1;
if a[q]> max then max:=a[q];
end;

if max mod k >0 then x:=1;
max:=(max div k)*k+x*k;

for i:=1 to 100 do if a[i]>0 then z:=z+(max-a[i]);

writeln(z);
end.

Program a;

var
	n, k, tmp, kolvoPriborov, max, blud, maxPrib, i:longint;
	aBoll:array[1..100] of boolean;
	maxArr:array[1..100] of Longint;
begin
	read(n, k);
	for i:=1 to 100 do aBoll[i]:=false;
	for i:=1 to 100 do maxArr[i]:=0;
	kolvoPriborov:=0;
	for i:=1 to n do begin
		read(tmp);
		if not(aBoll[tmp]) then begin
			aBoll[tmp]:=true;
			kolvoPriborov += 1;
		end;
		maxArr[tmp] += 1;
	end;
	max:=-1;
	for i:=1 to 100 do begin
		if maxArr[i]>max then max:=maxArr[i];
	end;
	blud:=max div k;
	if (max mod k<>0) then blud+=1;
	maxPrib:=k*kolvoPriborov*blud;
	for i:=1 to 100 do begin
		//writeln(maxArr[i], i:10);
		maxPrib -= maxArr[i];
	end;
	writeln(maxPrib);
end.

var p:array of uint64;
    d: array [1..100] of int64;
    c: boolean;
    o: boolean;
    k,n,m,u,y:int64;
begin
read(k,n);
o:=true;
setlength(p,k);
for var x:=0 to k-1 do
begin
read(p[x]);
d[p[x]]+=1;
end;
y:=1;
for var x:=1 to 100 do if d[x]>y then y:=d[x];
if y mod n =0 then
begin
u:=y div n ;
c:=true;
end
else
begin
u:=(y div n)+1;
c:=false;
end;
for var x:=1 to 100 do
begin
if d[x]<>0 then m+= n*u-d[x];
end;
if o then
write(m);
end.

program mos_olimp_2018_A;

var
  n, k: int64;
  i, j: int64;
  y, x, max, o, r: int64;
  a: array[1..100] of int64;
  b: array[1..100] of int64;
  c: array[1..100] of int64;
begin
  read(n, k);
  x := 0;
  for i := 1 to n do begin
    read(a[i]);
    y := 0;
    for j := 1 to x do begin
      if (a[i] = c[j]) then begin
        y := 1;
        b[j] += 1;
        break;
      end;
    end;
    if (y = 0) then begin
      x += 1;
      c[x] := a[i];
      b[x] += 1;
    end;
  end;
  max := b[1];
  for i := 1 to x do begin
    if (b[i] > max) then max := b[i];
  end;
  if (max mod k = 0) then begin
    r := max;
  end else begin
    r := (max div k + 1) * k;
  end;
  o := 0;
  for i := 1 to x do begin
    o += r - b[i];
  end;
  write(o);
end.

Program ABC;
Var
  a,b,c:array [1..100] of longint;
  i2,i,k,n,d,e,max,f,g:longint;
begin
  readln (n,k);
  f:=1;
  for i := 1 to n do begin
   read(a[i]);
   b[a[i]]:=b[a[i]] +1;
   g:=0;
   for i2 := 1 to f do
    if (a[i] = c[i2])then
      g :=1;
   if g = 0 then begin
    c[f]:=a[i];
    f:=f + 1;
  end;
  end;
  max:=0;
  f:=f - 1;
  for i := 1 to f do begin
   if (b[c[i]] > max) then
    max:=b[c[i]];
  end;
  d := ((max - 1 ) div k) +1;
  e:=0;
  for i := 1 to f do begin
   e:=e + (d * k) - b[c[i]];
  end;
  write(e);
end.

var
  a: array of int64;
  b: array [1..100] of int64;
  c: array [1..1000] of int64;
  d: array [1..1000] of int64;
  e: array [1..2000] of int64;
  v: array [1..2000] of int64;
  k, n, z, j, l, max: int64;

begin
  read(k, n);
  setlength(a, k);
  for l := 1 to 10 do
    v[l] := random(l);
  for l := 1 to 10 do
    e[l] := random(l);
  for l := 1 to 10 do
    d[l] := random(l);
  for l := 1 to 10 do
    c[l] := random(l);
  for var i := 0 to k - 1 do
  begin
    read(a[i]);
    b[a[i]] += 1;
  end;
  max := 1;
  for var i := 1 to 100 do if b[i] > max then max := b[i];
  if max mod n = 0 then j := max div n else j := (max div n) + 1;
  for var i := 1 to 100 do
  begin
    if b[i] <> 0 then z += n * j - b[i];
  end;
  write(z);
end.

program z1;
var a:array[1..100] of integer;
    b:array[1..100] of integer;
    n,k,i,j,m,q,t,h:integer;
BEGIN
read(n);
read(k);
if (n=0) or (k=0) then writeln(0)
  else begin
for i:=1 to n do begin
    read(m);
    a[i]:=m;
end;
m:=0;
for i:=1 to 100 do begin
    for j:=1 to 100 do begin
        if a[i]=j then
          b[j]:=b[j]+1;
    end;
end;
for i:=1 to 100 do
  if b[i]<>0 then q:=q+1;
m:=b[1];
for i:=1 to 100 do
    if b[i]>m then m:=b[i];
if (m mod k)<>0 then t:=(m div k)+1
  else t:=(m div k);
h:=t*q*k-n;
writeln(h);
end;
END.

program test1;

var
prib:array [0..100] of integer;
ost,gost:integer;
i,j:integer;
buf:integer;
count:integer;
 vid : set of integer;

max:integer;
blud:integer;
begin

readln(ost,gost);

for i:=1 to ost do begin
read(buf);
if (not(buf in vid)) then begin Include(vid,buf); inc(count); end;
inc(prib[buf]);
end;

max:=0;
foreach  j in vid do begin
  if (prib[j]>max) then max:=prib[j];
end;

if (max> (max div gost)*gost) then max:=max+gost;
blud:=max div gost;

writeln(gost*blud*count-ost);

end.

program abc;
var a:array[1..1000] of integer;
var b:array[1..1000] of integer;
var k,n,x,i,j,min,spec,vid:integer;
begin
spec:=1;
min:=0;
x:=1;
read(n,k);
for i:=1 to n do
begin
  read(a[i]);
  b[i]:=a[i];
  end;

  for i:=1 to n do
begin
if a[i]<>-5000 then vid:=vid+1;
  for j:=i+1 to n do
begin
if a[i]<>-5000 then begin

 if (a[i]=a[j]) then begin
 spec:=spec+1;
 a[j]:=-5000;
 end;
 end;
 if (a[i]=-5000) then spec:=k;
  end;
    while (x*k-spec<0)do begin
  x:=x+1;
  end;
  spec:=1;
  end;

 min:=k*x*vid-n;

write(min);

end.

program abc;
var n,a,k,s,i,mn:integer;
      m:array[1..1000] of integer;
begin
s:=0; mn:=1;
read(n);
read(k);
for i:=1 to n do
  begin
    read(a);
    inc(m[a]);
    if m[a]>(k*mn) then inc(mn);
  end;
for i:=1 to 1000 do
  if m[i]<>0 then
    s:=s+(k*mn-m[i]);
writeln(s);
end.

program hhj;
var n,k,x,y,i,j,z,b:integer;
   a: array [1..100] of integer;
 begin
   read (n,k);
   for i:= 1 to n do
     read (a[i]);
  for i := 1 to n-1 do
        for j := 1 to n-i do
            if a[j] > a[j+1] then begin
                x := a[j];
                a[j] := a[j+1];
                a[j+1] := x
            end;
  y:= a[1];
  z:= 1;
  x:= 0;
  b:= 0;
  for i:= 1 to n do
  begin
    if y = a[i] then
    begin
      x:= x + 1;
      if x > b then
        b:= x;
    end
    else
    begin
      x:= 1;
      y:= a[i];
      z:= z + 1;
    end;
  end;
  if b mod k = 0 then
  writeln ((k*(b div k)*z)-n)
  else
  writeln ((k*((b div k) + 1)*z)-n)

 end.

program z_a;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
    n, k, i, sum, x, max, k1: integer;
    a: array[1..100] of integer;

begin
    readln(n, k);
    sum := 0;
    max := 0;
    for i := 1 to n do
        a[i] := 0;
    for i := 1 to n do begin
        read(x);
        inc(a[x]);
    end;
    for i := 1 to 100 do
        if(a[i] > max) then
            max := a[i];
    k1 := k;
    while(k1 < max) do
        inc(k1, k);
    max := k1;
    for i := 1 to 100 do begin
        if(a[i] > 0) then
            inc(sum, max - a[i]);
    end;
    writeln(sum);
    readln;
    readln;
end.

var
  a:array[0..100000]of longint;
  n,m,s,i,x,max:longint;
begin
  readln(n,m);
  for i:=1 to n do
  begin
    read(x);
    inc(a[x]);
    if a[x]=1 then inc(s);
    if a[x]>max then max:=a[x];
  end;
  while max mod m<>0 do inc(max);
  writeln(s*max-n);
end.

var aaaaa:array of int64;
bbbbb: array [1..100] of int64;
k,n,z,j,max:int64;
aaaaaaaaa :array [1..10000] of integer;

begin

read(k,n);
for var dakda := 1 to 10000 do aaaaaaaaa[dakda] := dakda;
setlength(aaaaa,k);
for var i:=0 to k-1 do
begin
read(aaaaa[i]);
bbbbb[aaaaa[i]]+=1;
end;
max:=1;
for var i:=1 to 100 do if bbbbb[i]>max then max:=bbbbb[i];
if max mod n =0 then j:=max div n else j:=(max div n)+1;
for var i:=1 to 100 do
begin
if bbbbb[i]<>0 then z+= n*j-bbbbb[i];
end;
write(z);
end.

var a,b:array[1..1000] of longint;
     n,k,sum,k1,i:longint;
begin
read(n,k);
for i:=1 to n do
begin
read(a[i]);
b[a[i]]:=b[a[i]]+1;
end;
sum:=0;
k1:=1;
for i:=2 to 100 do
if b[k1]<b[i] then k1:=i;
if b[k1] mod k>0 then k:=k*((b[k1] div k)+1)
else k:=k*(b[k1] div k);
for i:=1 to 100 do
if (k>b[i])and(b[i]>0) then sum:=sum+k-b[i];
write(sum);
end.

program primer;
var a:array[1..101]of integer;
i,j,kol,k,n,max,x,h:integer;
c,otv:int64;
f1,f2:text;

BEGIN
readln(n,kol);
max:=0;k:=0;
for i:=1 to n do
   begin
   read(x);
   if a[x]=0 then k:=k+1;
   a[x]:=a[x]+1;
   if a[x]>max then max:=a[x];
   end;
if max mod kol= 0 then h:=max div kol
   else h:=max div kol+1;
c:=k*h*kol;
otv:=c-n;
write(otv);
end.

var
a,b:array[1..100] of longint;
n,m,i,j,z,k,max:longint;
begin
readln(n,k);
for i:= 1 to n do
begin
read(a[i]);
b[a[i]]:=b[a[i]]+1;
end;
for i:= 1 to 100 do
if b[i]>max then
max:=b[i];
if max mod k = 0 then
z:=max div k
else
z:=trunc(max div k)+1;
z:=z*k;
for i:=1 to 100 do
if b[i]<>0 then
inc(m);
z:=z*m;
writeln(z-n);
end.

var a,n,k,i,m,l,h: integer;
b: array [1..1000] of integer;
begin
readln(n,k);
for i:=1 to n do
begin
read(a);
b[a]:=b[a]+1;
end;
for i:=1 to 100 do
begin
if b[i]>m then m:=b[i];
if b[i]>0 then h:=h+1;
end;
l:=m div k;
if m mod k>0 then l:=l+1;
l:=l*k*h;
for i:=1 to 100 do
l:=l-b[i];
writeln(l);
end.

var a,d:array[1..1000] of longint;
i,j,n,m,k,l,z:longint;
begin
readln(n,k);
for i:=1 to n do
begin
read(a[i]);
inc(d[a[i]]);
end;
for i:=1 to 100 do
if m<d[i] then m:=d[i];
l:=m mod k;
if l>0 then l:=(m div k)+1 else l:=m div k;
for i:=1 to 100 do
if d[i]>0 then
z:=z+((l*k)-d[i]);
writeln(z);
end.

program za;
var i,n,k,g,ykr,maxl,st,r:integer;
mas:array[1..1000]of integer;
begin
read(n);
read(k);
for i:=1 to n do begin
read(g);
mas[g]:=mas[g]+1;
g:=0;
end;
for i:=1 to 1000 do
if mas[i]>maxl then maxl:=mas[i];
for i:=1 to 1000 do
if mas[i]<>0 then r:=r+1;
st:=1;
if maxl>k then begin
while maxl>k do begin
maxl:=maxl-k;
st:=st+1;
end;
end;
ykr:=st*r*k;
ykr:=ykr-n;
writeln(ykr);
end.

var n,k,i,c,r,m,g:integer;
    a,b:array [1..100] of integer;
begin
readln(n,k);
for i:=1 to n do
  begin
  read(a[i]);
  c:=a[i];
  b[c]:=b[c]+1;
  end;
m:=0;
r:=0;
for i:=1 to 100 do
  begin
  if b[i]>0 then r:=r+1;
  if b[i]>m then m:=b[i];
  end;
g:=m div k;
if m mod k>0 then g:=g+1;
write(r*g*k-n);
end.

var n,k,s,am,l:integer; a:array[1..100] of integer;
begin
readln(n,k);
for var i:=1 to n do
begin
read(s);
if (a[s]=0) then inc(l);
inc(a[s]);
if (a[s]>am) then am:=a[s];
end;
if (am mod k=0) then am:=am div k else am:=am div k +1;
s:=0;
writeln(l*am*k-n);
end.

var
a:array[1..100]of integer;
i,n,k,q,max,z,x:integer;
begin
readln(n,k);
for i:=1 to n do begin
read(q);
a[q]:=a[q]+1;
if a[q]> max then max:=a[q];
end;

if max mod k >0 then x:=1;
max:=(max div k)*k+x*k;

for i:=1 to 100 do if a[i]>0 then z:=z+(max-a[i]);

writeln(z);
end.

var
a,s,d,s1,otv,max:int64;
z,z2,z3:array[1..10000] of int64;
i,j:longint;
begin
read(a,s);
for i:=1 to a do
read(z[i]);
for i:=1 to a do
z2[z[i]]:=z2[z[i]]+1;
for i:=1 to 100 do
if z2[i]>0 then d:=d+1;
for i:=1 to 100 do
if z2[i]>max then max:=z2[i];
//
//for i:=1 to 100 do
//if z2[i]>0 then xx:=xx+1;
//for i:=1 to 100 do
//otv:=z2[i]+otv;
s1:=max div s;
if max mod s<>0 then s1:=s1+1;
write(s1*d*s-a);

end.

var
  a: array of int64;
  k, n, z, j, m: int64;

var
  p: array[1..100] of int64;

begin
  read(k, n);
  setlength(a, k);
  for var i := 0 to k - 1 do
  begin
    read(a[i]);
    p[a[i]] += 1;
  end;
  m := 1;
  for var i := 1 to 100 do if p[i] > m then m := p[i];
  if m mod n = 0 then j := m div n else j := (m div n) + 1;
  for var i := 1 to 100 do
  begin
    if p[i] <> 0 then z += n * j - p[i];
  end;
  write(z);
end.

var
i, j, n, k, kol, b, max, c:longint;
ans:int64;
a:array[1..1000] of longint;
begin
  readln(n, k);
  for i:=1 to n do
  begin
    read(b);
    inc(a[b]);
  end;
  for i:=1 to 100 do
  begin
    if a[i]<>0 then begin
      inc(kol);
      c:=(a[i]+k-1) div k;
      if c>max then max:=c;
      end;
  end;
  writeln(kol*k*max - n);
end.

var b,c,n,k,d,e:integer;
      a:array[1..100] of integer;
begin
  readln(n,k);
  for b:=1 to 100 do
  a[b]:=0;
  for b:=1 to n do
  begin
    read(c);
    a[c]:=a[c]+1;
  end;
  c:=-1;
  for b:=1 to 100 do
  if a[b]>c then
  c:=a[b];
  d:=0;
  d:=c div k;
  if  (c mod k)>0 then
  d:=d+1;
  e:=0;
  for b:=1 to 100 do
  if a[b]>0 then
  e:=e+(k*d-a[b]);
  writeln(e);
end.

Var i,n,k,kol,sum,ans : longint;
    a,b               : array[1..100] of integer;

Begin
read(n,k);
for i:=1 to n do
 begin
  read(a[i]);
  if b[a[i]]=0 then inc(sum);
  inc(b[a[i]]);
  if b[a[i]]>kol then kol:=b[a[i]];
 end;
 if k >= kol
  then ans:=(k*sum)-n
  else
   if kol mod k=0 then ans:=((kol div k)*sum*k)-n
                  else ans:=(((kol div k)+1)*sum*k)-n;
 writeln(ans);
end.

var
  log: array of int64;
  b: array [1..100] of int64;
  kof, n, zed, j, max: int64;
  g:array[1..10] of real;

begin
  for var i:=1 to 10 do
  begin
  g[i]:=i;
  end;
  read(kof, n);
  setlength(log, kof);
  for var i := 0 to kof - 1 do
  begin
    read(log[i]);
    b[log[i]] += 1;
  end;
  max := 1; //nicshe
  for var i := 1 to 100 do if b[i] > max then max := b[i];
  if max mod n = 0 then j := max div n else j := (max div n) + 1;
  for var i := 1 to 100 do
  begin
    if b[i] <> 0 then zed += n * j - b[i];
  end;
  write(zed);
end.

var a:array[1..100] of integer;
n,k,i,d,max,l,s:integer;
begin
max:=0;
readln (n,k);

for i:=1 to 100 do
a[i]:=0;
for i:=1 to n do
begin
read (d);
a[d]:=a[d]+1;
end;
s:=0; d:=0;
for i:=1 to 100 do
begin
if a[i]>max then max:=a[i];
if a[i]>0 then d:=d+1;
end;

if max mod k=0 then l:= max div k else l:= (max div k)+1;
s:=l*d*k-n;
writeln(s);
end.

var c,max,x,i,n,k:integer; a:array[1..100] of integer;
begin
readln(n,k);
for i:=1 to n do
begin
read(x);
inc(a[x]);
end;
for i:=1 to 100 do
begin
if a[i]>max then max:=a[i];
if a[i]<>0 then inc(c);
end;
if (max mod k)=0 then write(c*max-n) else
write(c*(  ((max div k)+1)*k  )-n)
end.

var a,b:array[1..100]of longint;
    otv,max,i,j,k,l,m,n:longint;
begin
    read(n,m);
    max := 0;
    for i := 1 to n do
        begin
            read(a[i]);
            inc(b[a[i]]);
            if max < b[a[i]] then max := b[a[i]];
        end;
    if max mod m <> 0 then
        begin
            while max mod m <> 0 do
                inc(max);
        end;
    otv := 0;
    for i := 1 to 100 do
        if b[i] <> 0 then otv := otv + (max - b[i]);
    writeln(otv);
end.

program a4;
var n, d, o, k, i, j, max: integer; a:array[1..100]  of integer;
begin
  readln(n, k);
  max:=0;
  j:=0;
  for i:= 1 to n do begin
    read (o);
    if a[o]=0 then
      j:= j+1;
    a[o]:= a[o]+1;
    if a[o]>max then
      max:= a[o];
  end;
  if max mod k <> 0 then
    max:= ((max div k) +1)*k*j
  else
    max:= (max div k)*k*j;
  max:= max - n;
  Writeln (max);
end.

var a:array of int64;
b: array [1..100] of int64;
k,n,z,j,i,max:int64;
x1,x2:real;

begin
read(k,n);
setlength(a,k);
for i:=0 to k-1 do begin
read(a[i]);
b[a[i]]+=1;
end;
x1:=1;
x2:=2;
for i:=1 to 100 do begin
    x1:=sqr(x1)+sqr(x2);
    x2:=sqrt(x1)+sqr(X2);
    end;
max:=1;
for i:=1 to 100 do if b[i]>max then max:=b[i];
if max mod n =0 then j:=max div n else j:=(max div n)+1;
for i:=1 to 100 do
begin
if b[i]<>0 then z+= n*j-b[i];
end;
write(z);
end.

type
  mas = array[1..100] of integer;

var
  n, i, k, kol, nom, max, chis: integer;
  m: mas;

begin
  kol := 0;
  max := 0;
  readln(n, k);
  for i := 1 to n do
  begin
    read(nom);
    m[nom] := m[nom] + 1;
  end;
  for i := 1 to 100 do
    if m[i] > 0 then
      kol := kol + 1;
  for i := 1 to 100 do
  begin
    chis := m[i] div k;
    if (m[i] mod k > 0) then chis := chis + 1;
    chis := chis * k;
    if chis > max then
      max := chis;
  end;
  writeln(max * kol - n);
end.

var n,k,i,x,count,q,m:longint;
a:array[1..100] of longint;
begin
 readln(n,k);
 for i:=1 to n do
 read(a[i]);
 while x=0 do
 begin
  x:=1;
  for i:=2 to n do
    if a[i]<a[i-1] then
    begin
     x:=a[i];
     a[i]:=a[i-1];
     a[i-1]:=x;
     x:=0;
    end;

 end;
 x:=a[1];
 m:=1;
 q:=1;
 for i:=2 to n do
 begin
  if a[i]=x then
   q+=1
  else
  begin
   if q>count then
    count:=q;
    q:=1;
    x:=a[i];
    m+=1;
    end;

 end;
 if q>count then count:=q;
 count:=(count-1)div k +1;
 writeln(count*m*k-n);
end.

begin
  var arr := new integer[100];
  var arrOgran := new boolean[100];
  var numPrib := 0;
  var numBlud := 0;
  var n, g: integer;
  Readln(n, g);

  for var i:= 1 to n do
  begin
  var h: integer;
  Read(h);
    arr[h - 1] += 1;
    end;

  if (n = 0) or (g = 0) then Print('0')
    else
  begin

    if not (arr.Max mod g = 0) then numBlud += 1;
    numBlud += (arr.Max div g);

    for var i := 0 to arr.Length - 1 do
    begin
      if (arr[i] > 0) and (not arrOgran[i]) then numPrib += 1;
      arrOgran[i] := True;
    end;

    Write(numBlud * g * numPrib - n);
  end;
end.

var
a,i,n,k,mn,ans:longint;
b:array [1..100] of longint;
function min(a,b:longint):longint;
begin
if a<b then
  min:=a
else
  min:=b;
end;

begin
readln(n,k);
for i:=1 to n do
  begin
  read(a);
  inc(b[a]);
  end;
mn:=1;
for i:=1 to 100 do
  if b[i] div k+min(1,b[i] mod k)>mn then
    mn:=b[i] div k+min(1,b[i] mod k);
for i:=1 to 100 do
 if b[i]>0 then
  ans:=ans+mn*k-b[i];
writeln(ans);
end.

program pr;
var a,b,i,q,e,k,kol,max,o:integer;
c:array [1..100] of integer;

begin
read(a);
read(b);
for i:=1 to a do
read(c[i]);
max:=1;

for q:=1 to a-1 do
begin
kol:=1;
for e:=q+1 to a do
if c[q]=c[e] then
kol:=kol+1;
if max<kol then
 max:=kol;
 end;
if max mod b >0 then
o:=1;
max:=max div b+o;

for q:=2 to a do
for e:=1 to q-1 do
if  c[q]=c[e] then
c[q]:=0;

for i:=1 to a do
if c[i]>0 then
k:=k+1;

write(k*b*max-a);

end.

program king;
var n,k,i,s,d:integer; a,b:array[1..100] of integer;
begin
read(n,k);
for i:=1 to n do
begin
read(a[i]);
b[a[i]]:=b[a[i]]+1;
end;
for i:=1 to 100 do
if (b[i] div k>d) and (b[i] mod k=0) then
d:=b[i] div k
else if (b[i]div k+1>d) and (b[i] mod k>0) then
d:=b[i] div k+1;
for i:=1 to 100 do
if b[i]<>0 then
s:=s+d*k-b[i];
writeln(s);
end.

program A1;
var n, k, i, m, mmax, f, otv: integer;
    a: array[1..100]of integer;
begin
   n:= 0;
   k:= 0;
   m:= 0;
   mmax:= 0;
   otv:= 0;
   f:= 0;
   ReadLn(n,k);
   for i:= 1 to n do
   begin
     Read(m);
     a[m]:= a[m] + 1;
     if a[m] > mmax then mmax:= a[m];
   end;
   if mmax mod k = 0 then
      f:= mmax div k
   else
      f:= Trunc(mmax/k) + 1;
   for i:= 1 to 100 do
   begin
      if a[i] <> 0 then
         otv:= otv + (k*f -a[i]);
   end;
   WriteLn(otv);
end.

program qq;
var k,n,a,b,c,f,d,i,max,e:longint;
    ki:array[1..100] of integer;
begin
readln(n,k);
For i:=1 to n do begin
 read(b);
ki[b]:=ki[b]+1;
end;
max:=0;
For i:=1 to 100 do
 if (ki[i]>max) then max:=ki[i];
c:=0;
e:=0;
For i:=1 to 100 do begin
if(ki[i]<>0) then
e:=e+1;
end;
writeln((max-k+1)*k*e-n);
end.

var
a:array[1..100]of integer;
i,n,k,q,max,z:integer;
begin
z:=0;
max:=0;
readln(n,k);
for i:=1 to n do begin
read(q);
a[q]:=a[q]+1;
if a[q]> max then max:=a[q];
end;
max:=(max div k)*k+(max mod k)*k;
for i:=1 to 100 do if a[i]>0 then z:=z+(max-a[i]);
writeln(z);
end.

program zadacha1;
var n,k,i,q,w,e:integer;
a:array[1..100] of integer;
begin
for i:=1 to 100 do
a[i]:=0;
w:=0;
e:=0;
readln(n);readln(k);
for i:=1 to n do begin
read(q);
a[q]:= a[q]+1;
if a[q]>e then e:=a[q]
end;
if (e mod k<>0) then
e:=e-(e mod k)+k;
for i:=1 to 100 do
if a[i]<>0 then w:=w+e-a[i];
write(w);
readln();
end.

program zadacha1;
var n,k,i,q,w,e:integer;
a:array[1..100] of integer;
begin
for i:=1 to 100 do
a[i]:=0;
w:=0;
e:=0;
readln(n);readln(k);
for i:=1 to n do begin
readln(q);
a[q]:= a[q]+1;
if a[q]>e then e:=a[q]
end;
if (e mod k<>0) then
e:=e-(e mod k)+k;
for i:=1 to 100 do
if a[i]<>0 then w:=w+e-a[i];
write(w);
readln();
end.

program zadacha1;
var n,k,i,q,w,e:integer;
a:array[1..100] of integer;
begin
for i:=1 to 100 do
a[i]:=0;
w:=0;
e:=0;
readln(n);readln(k);
for i:=1 to n do begin
read(q);
a[q]:= a[q]+1;
if a[q]>e then e:=a[q]
end;
if (e mod k<>0) then
e:=e-(e mod k)+k;
for i:=1 to 100 do
if a[i]<>0 then w:=w+e-a[i];
write(w);
end.

program project1;
var  n,k,i,prib,propalo,maxprib1vid:integer;
  mas:array[1..101] of integer;
begin
 for i:=1 to 101 do
 mas[i]:=0;
  propalo:=0;
 maxprib1vid:=0;
 readln(n,k);

 for i:=1 to n do begin
 readln(prib);
 mas[prib]:= mas[prib]+1;
 if mas[prib]>maxprib1vid then maxprib1vid:=mas[prib]
 end;
 if (maxprib1vid mod k<>0) then
 maxprib1vid:=maxprib1vid-(maxprib1vid mod k)+k;
 for i:=1 to 101 do
 if mas[i]<>0 then propalo:=propalo+maxprib1vid-mas[i];
 write(propalo);
 // readln();

end.

Program first;

type
	TData = Array[1..100] of Integer;

var
	count: TData;
	n,k,i,p,bluda,res,z: Integer;

Begin
	bluda:=1;
	readln(n,k);
	p:=k;
	for i:=1 to 100 do count[i]:=0;

	for i:=1 to n do begin
		read (z);
		count[z] += 1;
		if count[z]>k then begin
			bluda+=1;
			k *= 2;
		end;
	end;

	p := p*bluda;
	res:=0;

	for i:=1 to 100 do begin
		if count[i]<>0 then begin
			while count[i]<p do begin
				res +=1;
				count[i] +=1;
			end;
		end;
	end;
	writeln(res);
End.

Var n,k,l,max,h,i,g,x,m,b:integer;
    a:array[1..100] of integer;

Begin
readln(n,k);
for i:=1 to n do
read(a[i]);
h:=1;
While h<=100 do
begin
for i:=h to n do
 begin
 if a[h]=a[i] then begin l:=l+1  end;
 end;
if l>max then max:=l;
h:=h+1;
l:=0;
end;
writeln (max);
if max mod k > 0 then g:=(max div k) + 1  else g:=(max div k);
h:=1;
for h:=1 to 100 do
begin
for i:=1 to n do
    begin
    if a[i]=h then begin m:=m+1; break; end;
    end;
end;
writeln (m);

x:=(m*k*g) - n;
writeln(x);
end.

var n,i,dem,m,max:longint;
    a,b:array[1..100]of longint;
begin
 read(n,m);
 for i:=1 to n do
  begin
   read(a[i]);
   inc(b[a[i]]);
   if b[a[i]]>max then max:=b[a[i]];
  end;
 while m<max do
  begin
   inc(m,m);
   if m>max then break;
  end;
 for i:=1 to 100 do
  if b[i]<>0 then inc(dem,m-b[i]);
 write(dem);
end.

program ggg;
var n,m,k,i,p1,p2:integer;
a:array[1..100] of integer;
begin
readln(n,k);
for i:=1 to 100 do
a[i]:=0;
p2:=0;
m:=0;
for i:=1 to n do begin
readln(p1);
a[p1]:= a[p1]+1;
if a[p1]>m then m:=a[p1]
end;

if (m mod k<>0) then
m:=m-(m mod k)+k;
for i:=1 to 100 do
if a[i]<>0 then p2:=p2+m-a[i];
write(p2);
readln;
end.

var
a,s,d:int64;
z,z2,z3:array[1..10000] of int64;
i,j:longint;
begin
read(a,s);
for i:=1 to a do
read(z[i]);
for i:=1 to a do
z2[z[i]]:=1;
for i:=1 to 100 do
if z2[i]=1 then d:=d+1;
write(d-s);
end.

var
a,s,d,s1,otv,xx:int64;
z,z2,z3:array[1..10000] of int64;
i,j:longint;
begin
read(a,s);
for i:=1 to a do
read(z[i]);
for i:=1 to a do
z2[z[i]]:=z2[z[i]]+1;
for i:=1 to 100 do
if z2[i]>d then d:=z2[i];
xx:=0;
for i:=1 to 100 do
if z2[i]>0 then xx:=xx+1;
//for i:=1 to 100 do
//otv:=z2[i]+otv;
s1:=d div s;
if d mod s<>0 then s1:=s1+1;
write(abs(s1*d*s-a));

end.

var
a,s,d,s1,otv,xx:int64;
z,z2,z3:array[1..10000] of int64;
i,j:longint;
begin
read(a,s);
for i:=1 to a do
read(z[i]);
for i:=1 to a do
z2[z[i]]:=z2[z[i]]+1;
for i:=1 to 100 do
if z2[i]>0 then d:=d+1;
xx:=0;
for i:=1 to 100 do
if z2[i]>0 then xx:=xx+1;
//for i:=1 to 100 do
//otv:=z2[i]+otv;
s1:=d div s;
if d mod s<>0 then s1:=s1+1;
write(s1*d*s-a);

end.

var a,d:array[1..1000] of longint;
i,j,n,m,k,l:longint;
begin
readln(n,k);
for i:=1 to n do
begin
read(a[i]);
inc(d[a[i]]);
end;
for i:=1 to 100 do
if m<d[i] then m:=d[i];
m:=(m div k)+(m mod k);
for i:=1 to 100 do
if d[i]>0 then
l:=l+((m*k)-d[i]);
writeln(l);
end.

var a,d:array[1..1000] of longint;
i,j,n,m,k,l:longint;
begin
readln(n,k);
for i:=1 to n do
begin
read(a[i]);
inc(d[a[i]]);
end;
inc(l);
for i:=1 to 100 do
if (d[i] mod (l*k)>0) and (d[i]>k) then inc(l);
for i:=1 to 100 do
if d[i]>0 then m:=m+(l*k)-d[i];
writeln(m);
end.

program one;

var
  m, n1: array[1..100] of integer;
  s, s1: string;
  i, n, k, q, l, x, y: integer;

begin
  Readln(n, k);
  x := 0;
  y := k;
  for i := 1 to n do
  begin
    Read(n1[i]);
    q := n1[i];
    m[q] := m[q] + 1;
  end;
  for i := 1 to 100 do
  begin
    if m[i] > k then k := k + y;
  end;
  for i := 1 to 100 do
  begin
    if m[i] = 0 then m[i] := 101;
  end;
  for i := 1 to 100 do
  begin
    if (m[i] <> 101) then begin
      if m[i] <> k then x := x + (k - m[i]);
    end;
  end;
  Writeln(x);
end.

Var i,n,k,kol,sum,ans : longint;
    a,b               : array[1..100] of integer;

Begin
read(n,k);
for i:=1 to n do
 begin
  read(a[i]);
  if b[a[i]]=0 then inc(sum);
  inc(b[a[i]]);
  if b[a[i]]>kol then kol:=b[a[i]];
 end;
 if k >= kol
  then ans:=(k*sum)-n
  else ans:=(((kol div k)+1)*sum*k)-n;
 writeln(ans);
end.

Var i,n,k,kol,sum,ans : longint;
    a,b               : array[1..100] of integer;

Begin
read(n,k);
for i:=1 to n do
 begin
  read(a[i]);
  if b[a[i]]=0 then inc(sum);
  inc(b[a[i]]);
  if b[a[i]]>kol then kol:=b[a[i]];
 end;
 if k mod kol=0
  then ans:=(k*sum)-n
  else ans:=(((kol div k)+1)*sum*k)-n;
 writeln(ans);
end.

var a,b,n,c,i:integer;
begin
b:=0;
read(n);readln(a);
for i:=1 to n do begin read(c); b:=b+c end;
writeln(a*n-b)
end.

program pr;
var a,b,i,q,e,k:integer;
c:array [1..100] of integer;

begin
read(a);
read(b);
for i:=1 to a do
read(c[i]);
for q:=2 to a do
for e:=1 to q-1 do
if  c[q]=c[e] then
c[q]:=0;

for i:=1 to a do
if c[i]>0 then
k:=k+1;

write(k*b-a);

end.

var
  n, k, view, din, mug, i: byte;
  a: array [1..100] of byte;

begin
  read(n, k);
  din := 1;
  mug := 0;
  for i := 1 to 100 do
    a[i] := 0;
  for i := 1 to n do
  begin
    read(view);
    a[view] := a[view] + 1;
    if (a[view] / k) > din then din := din + 1;
  end;
  for i := 1 to 100 do if (a[i] > 0) and ((a[i] mod (din * k)) <> 0) then mug := mug + din * k - a[i];
  write(mug);
end.

var
  n, k, view, din, mug, i: byte;
  a: array [1..100] of byte;

begin
  read(n, k);
  din := 1;
  mug := 0;
  for i := 1 to 100 do
    a[i] := 0;
  for i := 1 to n do
  begin
    read(view);
    a[view] := a[view] + 1;
    if (a[view] / k) > din then din := din + 1;
  end;
  for i := 1 to 100 do if (a[i] > 0) and ((a[i] - (din * k)) <> 0) then mug := mug + din * k - a[i];
  write(mug);
end.

var A: array [1..100] of byte;
n,k,x,i,max,v,maxk: byte;
begin
read(n,k);
for i:= 1 to 100 do
 A[i]:=0;
max:=0;
v:=0;
for i:= 1 to n do begin
 read(x);
 A[x]:=A[x]+1 end;
for i:=1 to 100 do
 if (A[i]>k) and (A[i]/k>max) then begin
  if A[i] mod k = 0 then max:=A[i] div k else
   max:=(A[i] div k) + 1;
  maxk:=max*k end;
if maxk=0 then maxk:=k;
for i:=1 to 100 do
 if (A[i]>0) and (A[i]<maxk) then v:=v+maxk-A[i];
writeln(v);
end.

var a:array[1..100] of integer;
n,i,k,x,max,min,sum:integer;
begin
min:=1000;
readln (n,k);
for i:=1 to n do
  begin
  read(x);
  inc(a[x]);
  end;

for i:=1 to 100 do
  begin
  if a[i]>max then max:=a[i];
  if (a[i]<min) and (a[i]>0) then min:=a[i];

  end;
if max mod k=0 then x:=max div k
else x:=(max div k)+1;

writeln (abs((x*max*k)-n));

end.

var
  arr: array[1..100] of longint;
  k, n, i, ch, kolv, max: longint;

begin
  read(k, n);
  for i := 1 to k do
  begin
    read(ch);
    if arr[ch] = 0 then kolv := kolv + 1;
    arr[ch] := arr[ch] + 1;
  end;
  for i := 1 to 100 do
    if max < arr[i] then max := arr[i];
  if max mod n = 0 then write((max mod n) * kolv * n - k)
  else write(((max mod n) + 1) * kolv * n - k);
end.

program abc;
var n,a,k,s,i:integer;
      m:array[1..100] of integer;
begin
s:=0;
read(n);
read(k);
for i:=1 to n do
  begin
    read(a);
    inc(m[a]);
  end;
for i:=1 to 100 do
  if m[i]<>0 then
    s:=s+(k-m[i]);
writeln(s);
end.

program zA;
var
  n, k: integer;
  aAStr: array of string;
  //a: array [1..100] of integer;
  al: array [1..100] of integer;
  ai: integer;
  nk: array of string;
  nkStr, aStr: string;
  err: integer;
begin
  readln(nkStr);
  nk := nkStr.Split(' ');
  val(nk[0], n, err);
  val(nk[1], k, err);

  readln(aStr);
  aAStr := aStr.Split(' ');
  for var i := 0 to 99 do begin
    if i+1 > length(aAStr) then break;
    val(aAStr[i], ai, err);
    al[ai] := al[ai] + 1;
    writeln(al[ai], ' | ', ai);
  end;

  var aMax: integer := 0;
  var pNum: integer := 0;
  for var i := 1 to 100 do begin
    if al[i] > 0 then pNum := pNum + 1;
    if aMax < al[i] then aMax := al[i];
  end;

  writeln(aMax);

  var buff: integer := aMax mod k;
  var blNum: integer := aMax div k;
  if buff > 0 then blNum := blNum + 1;
  writeln(blNum);
  writeln((blNum*k*pNum)-n);
end.

program z_a;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
    n, k, i, sum, x, max: integer;
    a: array[1..100] of integer;

begin
    readln(n, k);
    sum := 0;
    max := 0;
    for i := 1 to n do
        a[i] := 0;
    for i := 1 to n do begin
        read(x);
        inc(a[x]);
    end;
    for i := 1 to 100 do
        if(a[i] > max) then
            max := a[i];
    if(max > k) then
        max := k * 2;
    for i := 1 to 100 do begin
        if(a[i] > 0) then
            inc(sum, max - a[i]);
    end;
    writeln(sum);
    readln;
    readln;
end.

program x;
var
a, n, k, i, col, m, e:integer;
b:array[1..100] of integer;
c:array[1..100] of integer;
begin
read(n, k);
for i:=1 to n do
  read(b[i]);
for i:=1 to n do
begin
  for e:=1 to 100do
    if(b[i]=e) then c[e]:=c[e]+1;
end;
for i:=1 to 100 do
  if(c[i]<>0) then col:=col+1;

m:=n div col;
//writeln(col);
//writeln(m);
//writeln(k);
writeln(col*m*k-n);

end.

var n, k, i, p, c:byte;
    a: array [1..100] of byte;
begin
  readln(n, k);
  for i:=1 to n do
    begin
      read(p);
      if a[p]=0 then c+=1;
      inc(a[p]);
    end;
  for i:=1 to 100 do
    if a[i]>k then begin k:=((a[i] div k)+1)*k; break; end;
  write(c*k-n);
end.

var n, k, i, p, c, max:byte;
    a: array [1..100] of byte;
begin
  readln(n, k);
  for i:=1 to n do
    begin
      read(p);
      if a[p]=0 then c+=1;
      inc(a[p]);
    end;
  for i:=1 to 100 do
    if a[i]>max then max:=a[i];
  if max>k then k:=((max div k)+1)*k;
  write(c*k-n);
end.

var n, k, i, p, s:byte;
    a: array [1..100] of byte;
begin
  readln(n, k);
  for i:=1 to n do
    begin
      read(p);
      inc(a[p]);
    end;
  for i:=1 to 100 do
    if a[i]>k then k:=((a[i] div k)+1)*k;
  for i:=1 to 100 do
    if (a[i]<>0) and (a[i]<k) then s+=k-a[i];
  write(s);
end.

program za;
var i,n,k,g,ykr,maxl,st,r,e:integer;
mas:array[1..1000]of integer;
begin
read(n);
read(k);
for i:=1 to n do begin
read(g);
mas[g]:=mas[g]+1;
g:=0;
end;
for i:=1 to n do
if mas[i]>maxl then maxl:=mas[i];
for i:=1 to 1000 do
if mas[i]<>0 then r:=r+1;
e:=r;
st:=1;
if maxl>k then begin
while maxl>k do begin
maxl:=maxl-k;
st:=st+1;
end;
end;
ykr:=st*r*k;
ykr:=ykr-n;
writeln(ykr);
end.