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.


-----Input-----

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-----

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


-----Examples-----
Input
5 2
1 2 2 1 3

Output
1

Input
10 3
1 3 3 1 3 5 5 5 5 100

Output
14



-----Note-----

In 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.

Difficulty: EASY

Solutions:
(n, k) = [int(y) for y in input().split()]
pn = [int(y) for y in input().split()]
p = [0 for y in range(100)]
kmpl = 0
for i in pn:
	p[i - 1] += 1
maxk = 0
import math
for i in p:
	if i > 0:
		kmpl += 1
	maxk = max(maxk, math.ceil(i / k))
print(maxk * kmpl * k - n)


(n, k) = map(int, input().split())
q = list(map(int, input().split()))
l = [0] * 100
t = 0
for i in range(n):
	if l[q[i] - 1] == 0:
		t += 1
	l[q[i] - 1] += 1
l.sort(reverse=True)
blud = (l[0] - 1) // k + 1
ans = blud * t * k - n
print(ans)


(n, k) = map(int, input().split())
ma = 0
a = str(input()).split()
m = set(a)
import collections
c = collections.Counter(a)
for y in c:
	if int(c[y]) > ma:
		ma = c[y]
while ma % k != 0:
	ma += 1
otv = len(m) * ma - n
print(otv)


(n, k) = map(int, input().split())
data = sorted(list(map(int, input().split())))
amm = set()
for i in data:
	amm.add(data.count(i))
plates = (max(amm) + k - 1) // k
s = len(set(data))
f = s * plates * k
print(f - n)


import collections
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = collections.Counter(a)
m = max(d.values())
p = 0
if m % k != 0:
	m = (m // k + 1) * k
for i in d.keys():
	p += m - d[i]
print(p)


nk = input().split()
n = int(nk[0])
k = int(nk[1])
razn = []
pr = input().split()
for i in pr:
	if not i in razn:
		razn.append(i)
maxc = 0
for i in razn:
	if pr.count(i) > maxc:
		maxc = pr.count(i)
blu = 0
if maxc % k == 0:
	blu = maxc // k
else:
	blu = maxc // k + 1
vspr = blu * len(razn) * k
ukr = vspr - len(pr)
print(ukr)


from math import ceil
(n, k) = map(int, input().split())
d = {}
m = 0
h = 0
for i in list(map(int, input().split())):
	d[i] = d.get(i, 0) + 1
	m = max(m, d[i])
m = ceil(m / k)
h = sum(d.values())
print(k * len(d) * m - h)


from math import ceil
(n, k) = list(map(int, input().split()))
data = list(map(int, input().split()))
countm = []
u = 0
for i in range(1, 101):
	countm.append(data.count(i))
bl = ceil(max(countm) / k)
for i in countm:
	if i > 0:
		u += bl * k - i
print(u)


(n, k) = list(map(int, input().split()))
ut = list(map(int, input().split()))
dict = {}
maximo = 0
for i in range(n):
	if ut[i] in dict:
		dict[ut[i]] += 1
		maximo = max(dict[ut[i]], maximo)
	else:
		dict[ut[i]] = 1
while maximo % k:
	maximo += 1
roubo = max(len(dict) * maximo - n, len(dict) * k - n)
print(roubo)


from math import ceil
sum = 0
(n, k) = map(int, input().split())
list_uten = list(map(int, input().split()))
vary = set(list_uten)
num_uten = []
for item in vary:
	num_uten.append(list_uten.count(item))
max_num = ceil(max(num_uten) / k) * k
for item in num_uten:
	sum += max_num - item
print(sum)


(a, b) = map(int, input().split(' '))
c = list(map(int, input().split(' ')))
g = []
y = 0
c.sort()
maxer = 0
maxert = []
for i in range(len(c)):
	maxer = 0
	if c[i] not in g:
		g.append(int(c[i]))
		y += 1
		for i2 in range(len(c)):
			if c[i] == c[i2]:
				maxer += 1
		maxert.append(int(maxer))
kolvo = round(float(max(maxert) / b) + 0.49)
print(kolvo * y * b - a)


(n, k) = [int(i) for i in input().split()]
data = {}
for i in input().split():
	if i in data:
		data[i] += 1
	else:
		data[i] = 1
max_num = 0
for i in data:
	if data[i] > max_num:
		max_num = data[i]
all_dishes = 0
if max_num % k == 0:
	all_dishes = max_num // k
else:
	all_dishes = max_num // k + 1
dishes = 0
for i in data:
	dishes += data[i]
print(all_dishes * k * len(data) - dishes)


import math
guests = input().split()
utensil = input().split()
notstolen = []
max = 0
stolen = 0
while utensil != []:
	counter = 0
	skp = 0
	y = utensil[0]
	for i in range(len(utensil)):
		if utensil[0 + skp] == y:
			counter += 1
			utensil.pop(0 + skp)
		else:
			skp += 1
	notstolen.append(counter)
	if counter > max:
		max = counter
test1 = int(guests[1])
test2 = math.ceil(max / int(guests[1]))
test = test1 * test2
for i in notstolen:
	stolen += int(test) - i
print(stolen)


import math
(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
types = [0] * 101
for i in range(n):
	types[arr[i]] += 1
m = 0
for i in range(len(types)):
	m = max(math.ceil(types[i] / k) * k, m)
tot = 0
for i in range(len(types)):
	if types[i]:
		tot += m - types[i]
print(tot)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
q = [0] * 101
for i in s:
	q[i] += 1
m = max(q)
r = set(s)
lr = len(r)
if m % k == 0:
	we = m // k
else:
	we = m // k + 1
qer = we * k * lr
print(qer - n)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
cnt = [0] * 101
mx = 0
for x in a:
	cnt[x] += 1
	if cnt[x] > cnt[mx]:
		mx = x
prib = 0
for x in cnt:
	if x:
		prib += 1
d = int(ceil(cnt[mx] / k))
print(d * k * prib - n)


(n, k) = map(int, input().split())
x = [int(i) for i in input().split()]
arr = []
for _ in range(100):
	arr.append(0)
for i in range(n):
	arr[x[i] - 1] = arr[x[i] - 1] + 1
numberOfUtensils = 0
numberOfCourses = 1
for i in range(0, 100):
	if arr[i] > 0:
		numberOfUtensils = numberOfUtensils + 1
		if arr[i] > k:
			if numberOfCourses < (arr[i] + k - 1) // k:
				numberOfCourses = (arr[i] + k - 1) // k
print(int(numberOfCourses * numberOfUtensils) * k - n)


import math
n = input().split()
guests = int(n[1])
n = int(n[0])
lay = dict()
lis = input().split()
for i in lis:
	if i not in lay:
		lay[i] = 1
	else:
		lay[i] += 1
minimum = 0
lay = list(lay.items())
lay.sort(key=lambda x: -x[1])
temp = lay[0][1] % guests
sravn = lay[0][1]
if temp != 0:
	sravn += math.fabs(guests - temp)
for i in lay:
	minimum += math.fabs(sravn - i[1])
print(int(minimum))


import math
(n, k) = map(int, input().split())
d = {}
ar = []
ar = [int(x) for x in input().split(' ')]
for i in ar:
	if i in d.keys():
		d[i] += 1
	else:
		d[i] = 1
maxim = max(d.values())
print(len(d.values()) * k * math.ceil(maxim / k) - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * 100
for i in range(n):
	b[a[i] - 1] += 1
m = max(b)
if m % k == 0:
	pass
else:
	m = m + (k - m % k)
kp = 0
for i in b:
	if i != 0:
		kp += 1
print(kp * m - n)


import math
(n, k) = map(int, input().split())
a = map(int, input().split())
values = [0] * 101
for value in a:
	values[value] += 1
quantity = math.ceil(max(values) / k) * k
res = 0
for value in values:
	if value != 0:
		res += quantity - value
print(res)


(n, k) = map(int, input().split())
a = [0 for i in range(101)]
for i in [int(i) for i in input().split()]:
	a[i] += 1
mx = 0
s = 0
for i in a:
	mx = max(mx, (i + k - 1) // k)
	if i:
		s += 1
print(mx * k * s - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0 for i in range(max(a) + 1)]
for i in a:
	b[i] += 1
ans = 0
servs = (max(b) + k - 1) // k
for i in b:
	if i != 0:
		ans += servs * k - i
print(ans)


(k, n) = map(int, input().split())
m = list(map(int, input().split()))
x = [0] * 100
for i in range(k):
	x[m[i] - 1] += 1
maximum = 0
nul = 0
for i in range(100):
	if x[i] != 0:
		nul += 1
	if maximum < x[i]:
		maximum = x[i]
print(nul * ((maximum + n - 1) // n) * n - k)


(n, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
d = {}
for i in arr:
	d[i] = d.get(i, 0) + 1
kits = ((d[max(d, key=lambda i: d[i])] - 1) // k + 1) * k
spizdili = 0
for i in d:
	spizdili += kits - d[i]
print(spizdili)


a = input().split()
bb = input().split()
from collections import Counter
counter = Counter(bb).most_common(1)[0]
count_tips_priborov = counter[1]
vid = len(set(bb))
bluda = 0
x = int(bluda * int(a[1]))
y = int(count_tips_priborov // int(a[1]) + 1)
while bluda * int(a[1]) < count_tips_priborov:
	bluda += 1
	if bluda * int(a[1]) >= count_tips_priborov:
		ukrali = bluda * int(a[1]) * vid - int(a[0])
		print(ukrali)
		break


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
c = set(a)
b = [0] * 101
for i in range(len(a)):
	b[a[i]] += 1
if max(b) % k != 0:
	z = max(b) * len(c) - sum(b) + len(c) * (k - max(b) % k)
else:
	z = max(b) * len(c) - sum(b)
print(z)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
d = {}
for x in a:
	d[x] = d.get(x, 0) + 1
m = max(d.values())
if m % k == 0:
	sets = m // k
else:
	sets = m // k + 1
print(sets * len(d) * k - n)


a = input().split()
(a, b) = (int(a[0]), int(a[1]))
k = list(map(int, input().split()))
n = []
maxk = 0
maxm = 0
for i in range(100):
	n += [0]
for i in k:
	i -= 1
	n[i] += 1
	c = n[i]
	if c > maxk:
		maxk = c
		maxm = (c - 1) // b * b + b
summ = 0
for i in n:
	if i > 0:
		summ += maxm - i
print(summ)


(n, k) = list(map(int, input().split()))
a = input().split()
unic = len(set(a))
max_count = max([a.count(i) for i in a])
dishes = max_count // k
if max_count % k:
	dishes += 1
print(dishes * unic * k - n)


import math
(n, k) = map(int, input().split())
prb = list(map(int, input().split()))
d = {}
count = 0
for el in prb:
	if not el in d:
		d[el] = 1
		count += 1
	else:
		d[el] += 1
m = -1
for el in d:
	if d[el] > m:
		m = d[el]
b = math.ceil(m / k)
pribors = count * b * k
print(pribors - n)


import math
inp = input().split()
n = int(inp[0])
k = int(inp[1])
left = input().split()
types = {}
maxx = 0
for i in range(n):
	if i == 0:
		maxx = left[0]
	try:
		types[left[i]] += 1
	except Exception:
		types[left[i]] = 1
	if types[left[i]] >= types[str(maxx)]:
		maxx = left[i]
needed = 0
dishes = 0
if types[str(maxx)] % k == 0:
	dishes = types[str(maxx)] / k
else:
	dishes = math.ceil((types[str(maxx)] + 0.1) / k)
for a in types:
	if dishes * k > types[a]:
		needed += dishes * k - types[a]
print(int(needed))


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
B = A.copy()
B.sort()
h = 0
l = 1
cur = B[0]
c = 0
for i in range(n):
	if B[i] == cur:
		c += 1
	if B[i] != cur:
		l += 1
		if c > h:
			h = c
		cur = B[i]
		c = 1
if c > h:
	h = c
if h < k:
	h += k - h
elif h % k != 0:
	h = k * (h // k + 1)
print(h * l - n)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for ai in a:
	d[ai] = d.setdefault(ai, 0) + 1
m = max(d.values())
c = math.ceil(m / k)
print(c * len(d.keys()) * k - n)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
u = {}
for i in a:
	if i not in u:
		u[i] = 1
	else:
		u[i] += 1
print(math.ceil(max(u.values()) / k) * len(u.keys()) * k - n)


from collections import Counter
from math import ceil
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
d = Counter()
for i in a:
	d[i] += 1
m = ceil(max(d.values()) / k) * len(d) * k
s = sum(d.values())
print(m - s)


import math
(n, k) = map(int, input().split())
a = [int(s) for s in input().split()]
b = set(a)
max1 = 0
for elem in b:
	if a.count(elem) > max1:
		max1 = a.count(elem)
bl = math.ceil(max1 / k)
pr = len(b)
kol = bl * k * pr
print(kol - n)


import math
(n, k) = [int(t) for t in input().split()]
arr = [int(t) for t in input().split()]
d = dict()
for i in range(len(arr)):
	try:
		d[arr[i]] += 1
	except:
		d[arr[i]] = 1
maxx = 0
for key in d:
	if d[key] > maxx:
		maxx = d[key]
ostalos = len(arr)
bilo = math.ceil(maxx / k) * len(d) * k
print(bilo - ostalos)


from collections import Counter
(n, k) = map(int, input().split())
cutlery = Counter((int(x) for x in input().split()))
print((max(cutlery.most_common(1)[0][1], k) + k - 1) // k * k * len(cutlery) - n)


import math
(n, k) = [int(x) for x in input().split(' ')]
lst = [int(x) for x in input().split(' ')]
d = {}
for i in range(n):
	if lst[i] in d:
		d[lst[i]] += 1
	else:
		d[lst[i]] = 1
m = 0
for key in d:
	if d[key] > m:
		m = d[key]
ans = math.ceil(m / k) * len(d) * k - n
print(ans)


from math import copysign as sign
(n, k) = map(int, input().split())
V = input().split()
H = [0] * 100
j = 0
for i in range(n):
	H[int(V[i]) - 100] += 1
t = max(H) // k
if max(H) % k > 0:
	t += 1
for i in range(100):
	if H[i] > 0:
		j += 1
print(k * j * t - n)


(n, d) = map(int, input().split())
c = {}
for x in input().split():
	c[x] = c.get(x, 0) + 1
a = (max(c.values()) + d - 1) // d
print(a * len(c) * d - n)


(n, k) = input().split()
n = int(n)
k = int(k)
b = 0
c = []
a = [int(i) for i in input().split()]
for i in range(len(a)):
	if a.count(a[i]) > b:
		b = a.count(a[i])
	if a[i] not in c:
		c.append(a[i])
if b % k == 0:
	d = b // k
else:
	d = b // k + 1
print(len(c) * k * d - n)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = []
bb = []
for i in range(1, 101):
	b.append(a.count(i))
	if b[i - 1] != 0:
		bb.append(i)
qq = (max(b) - 1) // k + 1
flag = k * len(bb) * qq - n
print(flag)


(n, k) = [int(x) for x in input().split()]
d = {}
number = [int(x) for x in input().split()]
multiplier = 1
for e in number:
	if e in d:
		d[e] -= 1
		if d[e] < 0:
			for key in d.keys():
				d[key] += k
			multiplier += 1
	else:
		d[e] = multiplier * k - 1
sum = 0
for k in d.keys():
	sum += d[k]
print(sum)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = [0] * 101
for i in a:
	c[i] += 1
m = (max(c) + k - 1) // k
ans = 0
for i in range(101):
	if c[i]:
		ans += max(0, m * k - c[i])
print(ans)


(n, k) = input().split()
(n, k) = (int(n), int(k))
(l, num) = (list(), list())
inp = input().split()
inp = [int(i) for i in inp]
for i in range(n):
	if inp[i] in l:
		num[l.index(inp[i])] += 1
	else:
		l.append(inp[i])
		num.append(1)
amount = max(num) * len(l) if max(num) % k == 0 else (max(num) // k * k + k) * len(l)
print(amount - n)


(n, d) = map(int, input().split())
a = list(map(int, input().split()))
b = []
k = 0
for i in range(1, 101):
	for j in range(n):
		if i == a[j]:
			k += 1
	if k != 0:
		b.append(k)
	k = 0
print(-(-max(b) // d) * len(b) * d - n)


from math import *
(n, k) = map(int, input().split())
b = list(map(int, input().split()))
b.sort()
s = 1
for i in range(1, n):
	if b[i] != b[i - 1]:
		s += 1
j = 0
s2 = 0
for j in range(n):
	if b.count(b[j]) > s2:
		s2 = b.count(b[j])
print(ceil(s2 / k) * k * s - n)


import math
(n, k) = map(int, input().split())
pribors = list(map(int, input().split()))
kinds = set(pribors)
max_kolvo = 0
for kk in kinds:
	kolvo = pribors.count(kk)
	if max_kolvo < kolvo:
		max_kolvo = kolvo
max_kolvo = k * math.ceil(max_kolvo / k)
all_ = max_kolvo * len(kinds)
print(all_ - n)


(a, b) = map(int, input().split())
c = []
d = 0
e = 0
c = input().split()
j = a
i = 1
k = []
while i > 0:
	g = c.count(c[0])
	e = c[0]
	if g > d:
		d = g
	while g > 0:
		c.remove(e)
		j = j - 1
		g = g - 1
	k.append(e)
	h = len(c)
	if h == 0:
		i = 0
l = len(k)
res = b * l * ((d - 1) // b + 1) - a
print(res)


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
N = a[0]
k = a[1]
b.sort()
n = 1
m = 0
p = 0
r = 0
for i in range(len(b)):
	if b[i] == p:
		n += 1
	if b[i] != p:
		r += 1
		if n > m:
			m = n
		n = 1
	if i == len(b) - 1:
		if n > m:
			m = n
	p = b[i]
if m % k == 0:
	j = m // k
else:
	j = m // k + 1
print(k * j * r - N)


(n, k) = map(int, input().split())
a = [int(j) for j in input().split()]
a.sort()
s = 0
j = []
maxi = a.count(a[0])
for i in range(len(a)):
	if a.count(a[i]) > maxi:
		maxi = a.count(a[i])
u = maxi / k
if u != int(u):
	u = int(u) + 1
else:
	u = int(u)
for i in range(len(a)):
	if j.count(a[i]) == 0:
		s += u * k - a.count(a[i])
		j.append(a[i])
print(s)


(n, k) = map(int, input().split())
ai = list(map(int, input().split()))
maxn = [ai.count(i) // k + int(ai.count(i) % k != 0) for i in range(101)]
ans = [(max(maxn) * k - ai.count(i)) * int(ai.count(i) > 0) for i in range(101)]
print(sum(ans))


(n, k) = map(int, input().split())
ess = list(map(int, input().split()))
dp = [-1] * 101
for i in range(n):
	b = ess[i]
	if dp[b] == -1:
		dp[b] = 0
	dp[b] += 1
ma = max(dp)
c = ma // k
if ma % k != 0:
	c += 1
ans = 0
for i in range(101):
	if dp[i] != -1:
		ans += c * k - dp[i]
print(ans)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
ans = [0] * 101
for i in range(n):
	ans[s[i] - 1] += 1
kb = 0
kp = 0
for i in range(101):
	kb = max(kb, (ans[i] - 1) // k + 1)
	if ans[i] != 0:
		kp += 1
print(kb * k * kp - n)


a = input().split()
n = int(a[0])
k = int(a[1])
b = input().split()
c = [0] * 100
x = 0
max = 0
for i in range(n):
	c[int(b[i]) - 1] += 1
	if c[int(b[i]) - 1] > max:
		max = c[int(b[i]) - 1]
max = (max - 1) // k + 1
for i in range(100):
	if c[i] != 0:
		x += k * max - c[i]
print(x)


(s, m, q) = (input().split(), 0, 0)
(n, k) = (int(s[0]), int(s[1]))
s = input().split()
s1 = set(s)
for i in s1:
	if s.count(i) > q:
		q = s.count(i)
		t = i
y = (q // k + 1) * k if q // k != q / k else q
for i in s1:
	if s.count(i) < y:
		m += y - s.count(i)
print(m)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
cnt = dict()
z = 0
mx = 0
for el in arr:
	if el not in cnt:
		cnt[el] = 0
	cnt[el] += 1
for el in cnt:
	mx = max(mx, cnt[el])
mx = (mx - 1) // k + 1
print(mx * len(cnt) * k - n)


(n, k) = map(int, input().split())
l = dict()
s = input().split()
a = []
maxx = 0
for i in range(n):
	a.append(int(s[i]))
	if int(s[i]) not in l:
		l[int(s[i])] = 1
		if maxx < 1:
			maxx = 1
	else:
		l[int(s[i])] += 1
		if maxx < l[int(s[i])]:
			maxx = l[int(s[i])]
lenkeys = len(l.keys())
print((maxx + k - 1) // k * k * lenkeys - n)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
s = [0] * 101
for i in range(n):
	s[m[i]] += 1
ans = 0
ma = 0
for i in range(101):
	if s[i] % k == 0:
		r = s[i] // k
	else:
		r = s[i] // k + 1
	ma = max(ma, r)
for i in range(101):
	if s[i] != 0:
		ans += ma * k - s[i]
print(ans)


(n, k) = map(int, input().split())
l = [*map(int, input().split())]
s = set(l)
maxUtensils = 0
for i in s:
	a = l.count(i)
	if a > maxUtensils:
		maxUtensils = a
numSet = k
while numSet < maxUtensils:
	numSet += k
print(len(s) * numSet - n)


(n, g) = map(int, input().split())
a = list(map(int, input().split()))
q = dict()
s = 0
bl = 1
for i in a:
	r = 0
	if i not in q:
		q[i] = 1
	else:
		q[i] += 1
		r = q[i] % g
		if r != 0:
			if q[i] // g + 1 > bl:
				bl = q[i] // g + 1
		elif q[i] // g > bl:
			bl = q[i] // g
for i in q:
	s += bl * g - q[i]
print(s)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = [0 for i in range(101)]
for i in a:
	b[i] += 1
ans = 0
h = max(b)
for i in b:
	if i != 0:
		ans += (h + m - 1) // m * m - i
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0 for i in range(max(a))]
t = 0
for i in a:
	b[i - 1] += 1
for i in b:
	if i != 0:
		t += 1
m = max(b)
if m % k != 0:
	m = m // k + 1
else:
	m //= k
print(m * t * k - n)


(n, k) = map(int, input().split())
ls = list(map(int, input().split()))
sp = [0] * 101
maxsp = 0
maxd = 0
for i in ls:
	sp[i] += 1
	maxd = max(maxd, i)
	maxsp = max(maxsp, sp[i])
dishes = (maxsp - 1) // k + 1
kek = 0
for i in sp[:maxd + 1]:
	if i != 0:
		kek += dishes * k - i
print(kek)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
dic = {}
for i in a:
	if i in dic:
		dic[i] += 1
	else:
		dic[i] = 1
maxi = 0
for (keys, value) in dic.items():
	if value > maxi:
		maxi = value
bluda = ceil(maxi / k)
baseCount = bluda * k * len(dic)
print(baseCount - n)


from math import ceil
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
ans = [0] * 100
for i in range(n):
	ans[m[i] - 1] += 1
ma = 0
for i in range(n):
	ma = max(ma, m.count(m[i]))
x = ceil(ma / k) * k
ot = 0
for i in range(100):
	if ans[i] != 0:
		ot += x - ans[i]
print(ot)


import math
(n, k) = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
d = {}
m = 0
for i in l:
	if not d.get(i):
		d[i] = 1
	else:
		d[i] += 1
	m = max(m, d[i])
total = math.ceil(m / k) * k * len(d)
print(total - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
import collections
b = collections.Counter(a)
c = b.most_common(1)[0][1]
gg = max((c + k - 1) // k, 1)
need = k * gg * len(b)
for i in b:
	need -= b[i]
print(need)


import math
(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
c = 0
d = set(a)
for i in d:
	if a.count(i) > c:
		c = a.count(i)
dishes = math.ceil(c / k)
total = k * len(d) * dishes
stolen = total - n
print(stolen)


from collections import Counter
from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = Counter(a)
m = max(c.values())
n_meals = int(ceil(m / k))
t = n_meals * len(c) * k
print(t - n)


(n, m) = map(int, input().split())
D = dict()
arr = list(map(int, input().split()))
for el in arr:
	if el in D.keys():
		D[el] += 1
	else:
		D[el] = 1
maxx = -1
for key in D.keys():
	if D[key] > maxx:
		maxx = D[key]
a = maxx // m
if maxx % m > 0:
	a += 1
summ = a * m
ans = 0
for key in D.keys():
	ans += summ - D[key]
print(ans)


(n, k) = map(int, input().split())
used = [0 for i in range(101)]
arr = list(map(int, input().split()))
maxi = -1
for i in arr:
	used[i] += 1
	maxi = max(maxi, used[i])
if maxi % k != 0:
	maxi += k - maxi % k
ans = 0
for i in used:
	if i != 0:
		ans += maxi - i
print(ans)


(n, k) = map(int, input().split())
a = input().split()
D = {}
for i in a:
	if i in D:
		D[i] += 1
	else:
		D[i] = 1
gostu_max = max(D.values())
if gostu_max % k == 0:
	bluda = gostu_max // k
else:
	bluda = gostu_max // k + 1
b = bluda * k * len(D)
print(b - n)


(a, g) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
m = A.count(A[0])
p = 1
for i in range(1, a):
	if A[i] != A[i - 1]:
		k = A.count(A[i])
		p = p + 1
		if m < k:
			m = k
b = m // g
if m % g > 0:
	b = b + 1
s = p * g * b
print(s - a)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
food = 1
s = dict()
result = 0
arr = []
for i in range(n):
	ans = 0
	if a[i] not in s:
		s[a[i]] = 1
	else:
		ans += s[a[i]] + 1
		s[a[i]] = ans
for key in s:
	if s[key] > k:
		arr.append(s[key])
if len(arr) > 0:
	maxArr = max(arr)
	while maxArr > k:
		food += 1
		maxArr -= k
	for key in s:
		result += k * food - s[key]
else:
	for key in s:
		result += k - s[key]
print(result)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(set(a))
m = 0
for i in b:
	x = a.count(i)
	if x > m:
		m = x
print((m - 1 + k) // k * len(b) * k - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
b = dict()
m = -1
for i in range(len(a)):
	if a[i] not in b:
		b[a[i]] = 1
	else:
		b[a[i]] += 1
for key in b:
	if b[key] > m:
		m = b[key]
ans += m // k
if m % k != 0:
	ans += 1
d = 0
for key in b:
	if b[key] < ans * k:
		d += ans * k - b[key]
print(d)


from collections import *
s = input()
numbers = list(map(int, s.split()))
n = numbers[0]
k = numbers[1]
s = input().split()
c = defaultdict(int)
for i in s:
	c[int(i)] += 1
a = max((c[i] for i in c))
a = ((a - 1) // k + 1) * k
print(a * len(c.keys()) - n)


(n, k) = [int(i) for i in input().split()]
mass = [int(i) for i in input().split()]
st = dict()
for i in mass:
	if i in st:
		st[i] += 1
	else:
		st[i] = 1
f = max(st.values())
cou = 0
if f % k == 0:
	f -= 1
for i in st.values():
	if i < (f // k + 1) * k:
		cou += (f // k + 1) * k - i
print(cou)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
number = {}
number_set = set(a)
for i in number_set:
	number[i] = 0
	for b in a:
		if i == b:
			number[i] += 1
max_number = 0
for i in number.values():
	if max_number < i:
		max_number = i
if max_number % k != 0:
	max_number += k - max_number % k
count = 0
for i in number.values():
	if i < max_number:
		count += max_number - i
print(count)


(n, k) = map(int, input().split())
M = [int(i) for i in input().split()]
N = [0] * 100
ans = 0
for i in range(n):
	N[M[i] - 1] += 1
m = max(N)
t = (m + k - 1) // k * k
for i in range(100):
	if N[i] % t != 0:
		ans += t - N[i] % t
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
x = len(set(a))
d = dict()
maxx = -1
for i in range(len(a)):
	d[a[i]] = d.get(a[i], 0) + 1
for i in d.values():
	if i > maxx:
		maxx = i
if maxx % k != 0:
	print((maxx // k + 1) * k * x - len(a))
else:
	print(maxx // k * k * x - len(a))


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
b = list(set(l))
maxpr = 0
for i in range(len(b)):
	if math.ceil(l.count(b[i]) / k) > maxpr:
		maxpr = math.ceil(l.count(b[i]) / k)
kol = len(b) * maxpr * k
print(kol - n)


from math import ceil
a = [0 for i in range(101)]
(n, k) = [int(i) for i in input().split()]
z = 0
b = [int(i) for i in input().split()]
for i in b:
	if a[i] == 0:
		z += 1
	a[i] += 1
m = max(a)
ob = ceil(m / k)
x = ob * k
o = 0
for i in a:
	if i != 0:
		o += x - i
print(o)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
b = []
c = []
for i in a:
	if i not in b:
		b.append(i)
		c.append(a.count(i))
if max(c) % k == 0:
	print(k * len(c) * (max(c) // k) - sum(c))
else:
	print(k * len(c) * (max(c) // k + 1) - sum(c))


import math
(a, b) = tuple(map(int, input().split()))
c = list(map(int, input().split()))
d = {}
max = 0
for i in c:
	d[i] = c.count(i)
for i in c:
	if c.count(i) > max:
		max = c.count(i)
k = math.ceil(max / b)
rez = 0
for i in d:
	rez += k * b - d[i]
print(rez)


input_array = list(map(int, input().split()))
cutlery_number = input_array[0]
guests_number = input_array[1]
cutlery = {}
input_array = list(map(int, input().split()))
for i in range(cutlery_number):
	a = input_array[i]
	try:
		cutlery[a] += 1
	except KeyError:
		cutlery[a] = 1
maximum = -1
for i in cutlery.keys():
	if cutlery[i] > maximum:
		maximum = cutlery[i]
if maximum % guests_number == 0:
	print(maximum // guests_number * guests_number * len(cutlery) - cutlery_number)
else:
	print((maximum // guests_number + 1) * guests_number * len(cutlery) - cutlery_number)


import math
n = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
l.sort()
x = set(l)
d = {i: l.count(i) for i in x}
m = math.ceil(max(d.values()) / n[1]) * n[1]
ans = 0
for i in d:
	ans += m - d[i]
print(ans)


def okr(n):
	if n == int(n):
		return int(n)
	else:
		return int(n) + 1
(n, m) = map(int, input().split())
p = list(map(int, input().split()))
pr = [0] * (max(p) + 1)
for i in range(n):
	pr[p[i]] += 1
bl = okr(max(pr) / m)
c = 0
for i in pr[1:]:
	if i:
		c += bl * m - i
print(c)


nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
x = list(map(int, input().split()))
a = []
b = []
ans = 0
for i in x:
	if not i in a:
		a.append(i)
		b.append(x.count(i))
if max(b) % k == 0:
	s = max(b) // k
else:
	s = max(b) // k + 1
for i in b:
	ans += s * k - i
print(ans)


(n, k) = map(int, input().split())
t = list(map(int, input().split()))
u = []
for j in set(t):
	u.append(t.count(j))
p = 0
s = max(u) // k
if max(u) % k > 0:
	s += 1
for j in u:
	p += s * k - j
print(p)


data = input().split(' ')
n = int(data[0])
k = int(data[1])
line = input().split(' ')
form = []
count = []
all = 1
for foo in range(len(line)):
	if line[foo] not in form:
		form.append(line[foo])
		count.append(1)
	else:
		ind = form.index(line[foo])
		count[ind] += 1
maxi = 0
for bar in range(len(count)):
	if count[bar] > maxi:
		maxi = count[bar]
	if maxi % k == 0:
		all = maxi // k
	else:
		all = maxi // k + 1
s = len(count) * k * all - n
print(s)


def king():
	ns = [0] * 111
	inp = input().split()
	left = int(inp[0])
	guests = int(inp[1])
	lst = list(map(int, input().split()))
	for i in lst:
		ns[i] += 1
	m = max(ns)
	if m % guests != 0:
		need = m + (guests - m % guests)
	else:
		need = m
	res = 0
	for i in ns:
		if i != 0:
			res += need - i
	return res
print(king())


(n, k) = [int(i) for i in input().split()]
mas = [0] * 102
maxx = 0
preb = 0
for i in input().split():
	if mas[int(i)] == 0:
		preb += 1
	mas[int(i)] += 1
	if maxx < mas[int(i)]:
		maxx = mas[int(i)]
if maxx % k != 0:
	blud = maxx // k + 1
else:
	blud = maxx // k
print(blud * preb * k - n)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
a = [0] * 101
for elem in l:
	a[elem] += 1
sh = (max(a) + k - 1) // k
v = 0
for elem in a:
	if elem != 0:
		v += 1
print(v * k * sh - n)


import math
from collections import Counter
tmp = input().split()
(amount, guests) = (int(tmp[0]), int(tmp[1]))
list = [int(i) for i in input().split()]
types = len(set(list))
cntr = Counter(list).most_common()[0][1]
dishes = math.ceil(cntr / guests)
print(types * guests * dishes - amount)


from sys import stdin, stdout
(N, M) = [int(x) for x in stdin.readline().split()]
arr = [int(x) for x in stdin.readline().split()]
freq = {}
maxi = 0
for num in arr:
	if num not in freq:
		freq[num] = 1
	else:
		freq[num] += 1
	maxi = max(maxi, freq[num])
bound = maxi // M + 1 * (maxi % M != 0)
bound *= M
res = 0
for key in freq:
	res += -freq[key] + bound
print(res)


import math
(n, k) = list(map(int, input().split()))
se = set()
d = dict()
a = list(map(int, input().split()))
for i in range(len(a)):
	if a[i] not in se:
		se.add(a[i])
		d[a[i]] = 1
	else:
		d[a[i]] += 1
a = list(se)
s = 0
x = 1
for i in range(len(a)):
	x = max(x, math.ceil(d[a[i]] / k))
for i in range(len(a)):
	s += k * x - d[a[i]]
print(s)


s = [int(n) for n in input().split()]
(n, k) = (s[0], s[1])
ck = [int(o) for o in input().split()]
v = dict()
for c in ck:
	v[c] = v.get(c, 0) + 1
m = max(v.values())
nz = m // k
if m % k != 0:
	nz += 1
print(nz * len(v) * k - n)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = dict()
s = set(a)
mx = 0
ans = 0
for i in range(n):
	b = a[i]
	if b in d:
		d[b] += 1
	else:
		d[b] = 1
	if d[b] > mx:
		mx = d[b]
c = ceil(mx / k) * k
print(c * len(s) - n)


(n, k) = tuple([int(i) for i in input().split()])
checks = [int(o) for o in input().split()]
dictin = {}
for check in checks:
	dictin[check] = dictin.get(check, 0) + 1
mm = max(dictin.values())
num_blud = mm // k if mm % k == 0 else mm // k + 1
vsego = num_blud * len(dictin) * k
print(vsego - n)


a = input()
a = a.split(' ')
a = [int(a[i]) for i in range(len(a))]
b = input()
b = b.split(' ')
b = [int(b[i]) for i in range(len(b))]
r = len(b)
u = len(set(b))
k = [0 for i in range(100)]
for i in range(r):
	k[b[i] - 1] = k[b[i] - 1] + 1
l = max(k) / a[1]
if l > int(l):
	l = l + 1
print(int(l) * u * a[1] - a[0])


import math
(num_remain, num_guest) = map(int, input().split())
remain = [int(x) for x in input().split()]
num_type = len(set(remain))
max_count = remain.count(remain[0])
for type in remain:
	if remain.count(type) > max_count:
		max_count = remain.count(type)
num_utensil = math.ceil(max_count / num_guest)
stolen = num_utensil * num_guest * num_type - num_remain
print(stolen)


import math
(n, k) = input().split()
(n, k) = (int(n), int(k))
N = [int(i00) for i00 in input().split()]
cut = 0
cutAll = []
r = 0
rez = 0
dish = 0
for i in N:
	if N.count(i) > cut:
		cut = N.count(i)
r = len(set(N))
dish = math.ceil(cut / k)
dish1 = dish * r
for q in set(N):
	cutAll.append(N.count(q))
for w in cutAll:
	rez += dish1 - w * dish
print(dish1 * k - n)


import math
(n, k) = input().split(' ')
(n, k) = (int(n), int(k))
types = input().split(' ')
types_dict = {}
for t in types:
	types_dict[t] = types_dict.get(t, 0) + 1
pred_amount = len(types_dict.keys()) * k
coef = 1
for i in types_dict.values():
	if i > k:
		new_coef = math.ceil(i / k)
		if new_coef > coef:
			coef = new_coef
print(coef * pred_amount - n)


pr = list(map(lambda x: 0, range(101)))
(n, k) = map(int, input().split())
inp = map(int, input().split())
for i in inp:
	pr[i] += 1
pr.sort(reverse=True)
m = pr[0] // k + bool(pr[0] % k)
m *= k
ans = 0
i = 0
while i <= 100 and pr[i] > 0:
	ans = ans + m - pr[i]
	i += 1
print(ans)


(n, k) = map(int, input().split())
a = map(int, input().split())
d = dict()
mx = 0
for i in a:
	d[i] = d.get(i, 0) + 1
	mx = max(mx, d[i])
ans = 0
mx += (k - mx % k) % k
for (x, y) in d.items():
	ans += mx - y
print(ans)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ras = set(l)
number = dict()
for j in l:
	if j not in number:
		number[j] = 1
	else:
		number[j] += 1
minbl = 0
for (q, w) in number.items():
	minbl = max(minbl, (w + k - 1) // k)
print(minbl * len(ras) * k - n)


(n, k) = map(int, input().split())
cnt = [0] * 101
arr = list(map(int, input().split()))
opt = 0
kind = 0
for i in arr:
	cnt[i] += 1
	kind += cnt[i] == 1
	opt = max(opt, cnt[i])
food = opt // k + (opt % k > 0)
S = food * k * kind
for i in cnt:
	S -= i
print(S)


a = input().split()
b = input().split()
n = int(a[0])
k = int(a[1])
q = dict()
o = []
y = 0
for i in b:
	if i in q:
		q[i] += 1
	if i not in q:
		q[i] = 1
		o.append(i)
for i in o:
	if y < q[i]:
		y = q[i]
if y % k == 0:
	p = y // k
else:
	p = y // k + 1
print(k * p * len(o) - n)


from math import ceil, floor
from collections import defaultdict as dd
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
d = dd(lambda : 0)
for i in l:
	d[i] += 1
s = len(set(l))
a = max(d.values())
m = ceil(a / k)
if a > k:
	print(s * m * k - n)
else:
	print(s * k - n)


from collections import Counter
(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
c = len(set(a))
d = Counter(a)
mx = 0
for (_, i) in d.items():
	mx = max(mx, (i + k - 1) // k)
print(mx * c * k - n)


from collections import Counter
count = Counter()
(n, k) = map(int, input().split())
prib = [int(i) for i in input().split()]
res = 0
for i in prib:
	count[i] += 1
d = count.most_common(1)[0][1]
dic = dict(count)
if d % k == 0:
	for (key, i) in dic.items():
		res += d - i
else:
	d += k - d % k
	for (key, i) in dic.items():
		res += d - i
print(res)


from collections import Counter
I = lambda : map(int, input().split())
(n, k) = I()
c = Counter(I())
print(-(-max(c.values()) // k) * k * len(c) - n)


(n, k) = [int(s) for s in input().split()]
mass = [int(s) for s in input().split()]
set1 = set(mass)
set2 = list(set1)
set2.sort()
maxim = 0
for i in range(len(set2)):
	z = mass.count(set2[i])
	if z > maxim:
		maxim = z
if maxim % k == 0:
	maxim = maxim // k
else:
	maxim = maxim // k + 1
kolvo = len(set2) * maxim * k
print(kolvo - n)


(n, k) = map(int, input().split())
c = {}
a = [int(x) for x in input().split()]
for i in a:
	c[i] = c.get(i, 0) + 1
m = 0
for i in c:
	l = c[i] % k
	if l > 0 and c[i] > m:
		m = c[i] + k - l
	elif l == 0 and c[i] > m:
		m = c[i]
s = 0
for i in c:
	s += m - c[i]
print(s)


import collections
(n, chel) = map(int, input().split())
a = list(map(int, input().split()))
a = collections.Counter(a)
max_prob = max(a.values())
while max_prob % chel != 0:
	max_prob += 1
vsego = max_prob * len(a.keys())
result = vsego - sum(list(a.values()))
print(int(result))


(n, k) = map(int, input().split())
line = [int(x) for x in input().split()]
count = [0] * 101
for i in line:
	count[i] += 1
an = 0
maxi = 0
for i in range(1, 101):
	maxi = max(maxi, (count[i] + k - 1) // k)
for i in range(1, 101):
	if count[i] > 0:
		an += maxi * k - count[i]
print(an)


(n, k) = list(map(int, input().split()))
u_s = list(map(int, input().split()))
dik = {}
for u in u_s:
	dik[u] = dik.get(u, 0) + 1
maxu = max(dik.values())
import math
num_dish = math.ceil(maxu / k)
print(num_dish * len(set(u_s)) * k - n)


nk = input().split()
n = int(nk[0])
k = int(nk[1])
forks = [int(x) for x in input().split()]
count_forks = {}
for i in forks:
	if i not in count_forks.keys():
		count_forks[i] = 1
	else:
		count_forks[i] += 1
answer = 0
max = 0
for i in count_forks.keys():
	if max < count_forks[i]:
		max = count_forks[i]
for i in count_forks.keys():
	answer += max - count_forks[i]
help = k
while help < max:
	help += k
answer += len(count_forks.keys()) * (help - max)
print(answer)


(n, k) = [int(a) for a in input().strip().split()]
utensils = [int(x) for x in input().strip().split()]
c = {}
for i in utensils:
	if i in c:
		c[i] += 1
	else:
		c[i] = 1
typecounts = list(c.values())
max = max(typecounts)
set = -(-max // k)
totalutensils = len(typecounts) * set * k
print(totalutensils - n)


def r(x):
	if x > int(x):
		return x + 1
	return x
(n, k) = map(int, input().split())
sum = 0
co = [0 for _ in range(100)]
l = list(map(int, input().split()))
for i in l:
	co[i - 1] += 1
m = max(co)
if m <= k:
	for i in co:
		if i != 0:
			sum += k - i
else:
	k = k * (m // k + (1 if m / k != m // k else 0))
	for i in co:
		if i != 0:
			sum += k - i
print(sum)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
m = 0
for i in a:
	if a.count(i) > m:
		m = a.count(i)
while m % k != 0:
	m += 1
print(len(set(a)) * m - len(a))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
curMax = 0
maps = {}
for a in arr:
	if a not in maps:
		maps[a] = 1
	else:
		maps[a] += 1
	curMax = max(curMax, maps[a])
if curMax % k != 0:
	curMax = curMax - curMax % k + k
print(curMax * len(maps) - len(arr))


import math
from collections import defaultdict
(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
b = defaultdict(int)
for el in a:
	b[el] += 1
x = max(b.values())
v = math.ceil(x / k)
r = 0
for el in b.values():
	r += v * k - el
print(r)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
bl = 0
unic = []
minpr = 0
for i in a:
	if i not in unic:
		unic.append(i)
		bl = max(bl, (a.count(i) + k - 1) // k)
for i in unic:
	minpr += bl * k - a.count(i)
print(minpr)


count = 0
b = [int(s) for s in input().split()]
n = b[0]
k = b[1]
a = input().split()
max = a.count(max(a, key=a.count))
for i in range(len(a)):
	a[i] = int(a[i])
a = sorted(a)
type = 1
for i in range(0, len(a) - 1):
	if a[i] != a[i + 1]:
		type += 1
if max % k > 0:
	dish = max // k + 1
else:
	dish = max // k
sum = type * dish * k
print(sum - n)


(n, k) = map(int, input().split())
mass = list(input().split())
maxx = 0
s = set()
c = 0
b = 0
for i in mass:
	s.add(i)
	if mass.count(i) > maxx:
		maxx = mass.count(i)
while c < maxx:
	b += 1
	c = b * k
print(b * len(s) * k - n)


used = []
quant = []
anw = 0
s = input()
(m, n) = s.split()
n = int(n)
s = input()
types = s.split()
types = [int(x) for x in types]
for num in types:
	if num not in used:
		used.append(num)
		quant.append(types.count(num))
limit = max(quant)
while limit % n != 0:
	limit += 1
for num in quant:
	anw += limit - num
print(anw)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
d = set()
f = dict()
for i in c:
	d.add(i)
	if i in f:
		f[i] += 1
	else:
		f[i] = 1
g = 1
for i in f:
	if f[i] >= g:
		g = f[i]
e = g // b
if g % b != 0:
	e += 1
print(e * b * len(d) - a)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
tmp = [0 for i in range(101)]
for i in range(n):
	tmp[a[i]] += 1
w = (max(tmp) + k - 1) // k
w *= k
ans = 0
for i in tmp:
	if i != 0:
		ans += w - i
print(ans)


nk = list(map(int, input().split()))
a = list(map(int, input().split()))
n = nk[0]
k = nk[1]
st = []
kol = []
s = 0
b = 1
for i in a:
	if st.count(i) == 0:
		st.append(i)
		kol.append(1)
	else:
		kol[st.index(i)] += 1
		if kol[st.index(i)] > b * k:
			b += 1
for i in kol:
	s += b * k - i
print(s)


p = input().split()
n = int(p[0])
k = int(p[1])
m = 0
o = []
a = input().split()
for i in range(n):
	a[i] = int(a[i])
	cnt = a.count(a[i])
	if m < cnt:
		m = cnt
		m1 = a[i]
	if a[i] not in o:
		o.append(a[i])
x = m // k
if m % k > 0:
	x += 1
print(len(o) * k * x - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = set(a)
mx = -float('inf')
c = 0
for i in a:
	mx = max(mx, a.count(i))
if mx % k != 0:
	mx = (mx + k) // k
else:
	mx //= k
print(len(b) * mx * k - n)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
d = {}
for i in range(n):
	d[lst[i]] = d.get(lst[i], 0) + 1
h = 0
s = max(d.values())
while s % k != 0:
	s += 1
for x in d.values():
	h += s - x
print(h)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
c = [0] * 100
for i in a:
	c[i - 1] += 1
c = [x for x in c if x != 0]
b = max(c)
f = (b // k + (b % k != 0)) * k
g = [f - x for x in c]
d = sum(g)
print(d)


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
m = {}
ans = 0
s = -10 ** 9
for i in l:
	if i in m:
		m[i] += 1
	else:
		m[i] = 1
for i in m:
	s = max(s, m[i])
s += (k - s % k) % k
for i in m:
	ans += s - m[i]
print(ans)


o = input().rstrip().split(' ')
p = input().rstrip().split(' ')
x = list(set(p))
l = []
R = 0
for i in range(0, len(x)):
	l.append(p.count(x[i]))
l.sort(key=int, reverse=True)
for i in range(0, 1000000000):
	y = int(l[0]) + i
	if y % int(o[1]) == 0:
		t = y
		break
for i in range(0, len(l)):
	R = R + (t - int(l[i]))
print(R)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
kolvo = len(set(a))
bludy = kolvo * k
l = 0
for i in set(a):
	if a.count(i) > l:
		l = a.count(i)
bl = l // k
if l % k != 0:
	bl += 1
print(bludy * bl - n)


from math import ceil
(n, k) = input().split()
(n, k) = (int(n), int(k))
data = input().split()
dat = []
a = 0
for i in data:
	if int(data.count(i)) > a:
		a = int(data.count(i))
	if i not in dat:
		dat.append(i)
print(k * len(dat) * ceil(a / k) - n)


from collections import Counter
import math
(n, k) = map(int, input().split())
s = list(map(int, input().split()))
dic = Counter(s)
num = 1
for (key, value) in dic.items():
	temp = math.ceil(value / k)
	if temp > num:
		num = temp
print(len(dic) * num * k - n)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0] * 100
for i in range(n):
	b[a[i] - 1] += 1
ma = max(b)
if ma % k != 0:
	min_my = ma // k * k + k
else:
	min_my = ma
ans = 0
for i in range(100):
	if b[i] != 0:
		ans += min_my - b[i]
print(ans)


(n, k) = map(int, input().split())
mas = map(int, input().split())
incl = dict()
maxim = 0
for i in mas:
	if incl.get(i) == None:
		incl[i] = 1
	else:
		incl[i] += 1
	if incl[i] > maxim:
		maxim = incl[i]
print((maxim + k - 1) // k * len(incl) * k - n)


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
s = len(set(a))
maxx = 0
for i in a:
	maxx = max(maxx, a.count(i))
if maxx % m == 0:
	maxx //= m
else:
	maxx = maxx // m + 1
print(maxx * s * m - n)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = set(a)
c = 0
for p in b:
	t = a.count(p)
	if t > c:
		c = t
if c <= k:
	d = 1
else:
	d = ceil(c / k)
print(k * d * len(b) - n)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
y = []
k1 = 0
ma1 = 0
for i in range(n):
	if a[i] not in y:
		y.append(a[i])
		k1 += 1
		if ma1 < a.count(a[i]):
			ma1 = a.count(a[i])
q = 1
mak = ma1 * k1
k2 = k * k1
while mak > k2 * q:
	q += 1
print(k2 * q - n)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a_set = set(a)
l = len(a_set)
f = a.count(a_set.pop())
for i in range(l - 1):
	m = a.count(a_set.pop())
	if f < m:
		f = m
if f % k != 0:
	f = (f // k + 1) * k
print(l * f - n)


from math import ceil
(n, k) = map(int, input().split())
ms = list(map(int, input().split()))
sl = dict()
mx = 1
g = 0
for i in ms:
	if i in sl:
		sl[i] += 1
		mx = max(sl[i], mx)
	else:
		sl[i] = 1
		g += 1
j = ceil(mx / k)
print(g * k * j - n)


from math import ceil
(n, k) = [int(s) for s in input().split()]
mas = [int(s) for s in input().split()]
sett = set(mas)
ans = 0
hm = 0
ans1 = 0
for x in sett:
	s = mas.count(x)
	if s > ans:
		ans = s
		hm = x
l = ceil(ans / k)
nabor = k * l
for x in sett:
	s = mas.count(x)
	ans1 += nabor - s
print(ans1)


(n, k) = map(int, input().split())
a = input().split()
d = {}
for e in a:
	d[e] = d.get(e, 0) + 1
z = max(d.values()) / k
z1 = max(d.values()) // k
k_blu = z if z - z1 == 0 else z1 + 1
print(int(k_blu * len(d) * k - n))


def maxelofdict(D):
	ans = 0
	for i in D.keys():
		if D[i] > ans:
			ans = D[i]
	return ans
D = {}
(n, k) = map(int, input().split())
A = []
ans = 0
for i in input().split():
	if i not in D.keys():
		D[i] = 1
	else:
		D[i] += 1
maxel = maxelofdict(D)
while True:
	if maxel % k != 0:
		maxel += 1
	else:
		break
for i in D.keys():
	if D[i] < maxel:
		ans += maxel - D[i]
print(ans)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
cnt = [0] * 100
for i in A:
	cnt[i - 1] += 1
mx = max(cnt)
cntnab = mx // k
if mx % k != 0:
	cntnab += 1
out = 0
for i in cnt:
	if i != 0:
		out += cntnab * k - i
print(out)


from math import ceil
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
assert n == len(a)
b = {}
for i in range(n):
	if a[i] not in b:
		b[a[i]] = a.count(a[i])
d = ceil(max(b.values()) / k)
s = d * len(b) * k - n
print(s)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
p = set(a)
b = len(p)
d = dict()
for i in p:
	d[i] = 0
for i in a:
	d[i] = d.get(i) + 1
f = d.values()
if max(f) % k == 0:
	print(max(f) * b - len(a))
else:
	j = max(f) // k + 1
	print(j * b * k - len(a))


(n, k) = map(int, input().split())
dList = list(map(int, input().split()))
maxD = 0
d = {}
for i in dList:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
	if d[i] > maxD:
		maxD = d[i]
amount = 0
dis = ((maxD - 1) // k + 1) * k
for i in d.values():
	amount += dis - i
print(amount)


(n, k) = (int(e) for e in input().split(' '))
arr = [int(e) for e in input().split(' ')]
real_k = k
d = dict()
for e in arr:
	if e not in d:
		d[e] = 0
	d[e] += 1
maxval = max(d.values())
while maxval > k:
	k += real_k
res = 0
for key in d:
	e = d[key]
	res += k - e
print(res)


from collections import Counter as C
from math import *
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ax = C(a).most_common()
maxx = max(ax, key=lambda x: x[1])
m = ceil(maxx[1] / k)
cnt = 0
for (i, c) in ax:
	cnt += k * m - c
print(cnt)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bl = 1
count = 0
now = 1
for i in range(1, n):
	if a[i] != a[i - 1]:
		bl += 1
		count = max(count, now)
		now = 1
	else:
		now += 1
count = max(count, now)
t = (count + k - 1) // k
print(t * bl * k - n)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
kolvo = [0] * 100
nabor = 0
otvet = 0
for i in range(0, n):
	kolvo[m[i] - 1] = kolvo[m[i] - 1] + 1
if max(kolvo) / k > max(kolvo) // k:
	nabor = max(kolvo) // k + 1
else:
	nabor = max(kolvo) // k
for i in range(0, 100):
	if kolvo[i] != 0:
		otvet = otvet + (k * nabor - kolvo[i])
print(otvet)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
pos = input().split(' ')
dishes = 1
tools = 0
tools1 = 0
u = []
t = []
for i in pos:
	if i not in t:
		tools += 1
		t += [i]
for z in pos:
	if pos.count(z) > tools1:
		tools1 = pos.count(z)
		dishes = (tools1 + k - 1) // k
count = dishes * tools * k
print(count - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
ans = 0
for i in a:
	try:
		d[i] += 1
	except KeyError:
		d[i] = 1
m = -(-max(d.values()) // k) * k
for key in d.keys():
	ans += m - d[key]
print(ans)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
ans = [0 for i in range(1, 101)]
for i in x:
	ans[i - 1] = ans[i - 1] + 1
(m, mk) = (ans[0], 0)
for i in range(1, 100):
	if m < ans[i]:
		m = ans[i]
		mk = i
pro = 0
if m <= k:
	pro = 1
elif m % k == 0:
	pro = m / k
else:
	pro = m // k + 1
error = pro * k
s = 0
for i in ans:
	if i != 0:
		s = s + (error - i)
print(int(s))


read = lambda : map(int, input().split())
(n, k) = read()
a = list(read())
appear = [0] * 100
for x in a:
	appear[x - 1] += 1
count_dish = (max(appear) + k - 1) // k
utensil_set_count = len(appear) - appear.count(0)
print('%s' % (k * count_dish * utensil_set_count - n))


a = int(input().split()[1])
z = input().split()
b = [int(x) for x in z]
b1 = [int(x) for x in z]
answ = 0
bluda = 0
check = []
while len(b1) != 0:
	i = b1[0]
	if i not in check:
		check.append(i)
	if b1.count(i) > a:
		if b1.count(i) % a > 0 and b1.count(i) // a + 1 > bluda:
			bluda = b1.count(i) // a + 1
		elif b1.count(i) // a > bluda:
			bluda = b1.count(i) // a
		while i in b1:
			b1.remove(i)
	else:
		if b1.count(i) < a:
			answ += a - b1.count(i)
		while i in b1:
			b1.remove(i)
nabor = len(check) * bluda * a
if nabor == 0:
	print(answ)
else:
	print(nabor - len(b))


import math
p = 0
b = 0
x = input().split(' ')
n = int(x[0])
k = int(x[1])
m = [0] * 101
x = input().split(' ')
for i in x:
	i = int(i)
	m[i] += 1
for i in m:
	i = int(i)
	if i > 0:
		p += 1
		b = max(b, math.ceil(i / k))
print(k * p * b - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = max([a.count(q) for q in a])
f = len(set(a))
g = (d + k - 1) // k
print(f * g * k - n)


import math
(n, k) = map(int, input().split())
mas = list(map(int, input().split()))
s = list(set(mas))
mascou = []
for i in s:
	mascou.append(mas.count(i))
x = math.ceil(max(mascou) / k) * k
ans = 0
for i in mascou:
	ans += x - i
print(ans)


import math
(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
sa = set(a)
csa = [a.count(i) for i in sa]
print(int(math.ceil(max(csa) / k)) * len(sa) * k - n)


(n, k) = (int(x) for x in input().split())
g = dict()
f = [int(x) for x in input().split()]
for i in f:
	g[i] = g.get(i, 0) + 1
f = sorted(g.values())
cnt = f[-1]
cnt = (cnt // k + (1 if cnt % k != 0 else 0)) * k
out = 0
for i in f:
	out += cnt - i
print(out)


(n, k) = map(int, input().split())
a = [0] * 101
maxi = 0
for x in input().split():
	a[int(x)] += 1
	if a[int(x)] > a[maxi]:
		maxi = int(x)
t = a[maxi]
while t % k != 0:
	t += 1
ans = 0
for i in range(1, 101):
	if a[i] != 0:
		ans += t - a[i]
print(ans)


(n, k) = map(int, input().split())
numbers = input().split()
dicty = {}
maximum = 0
for number in numbers:
	temp = dicty.get(number, 0) + 1
	dicty[number] = temp
	if temp > maximum:
		maximum = temp
max_dishes = maximum // k + int(bool(maximum % k))
stolen = 0
for tableware in dicty:
	stolen += max_dishes * k - dicty[tableware]
print(stolen)


(n, k) = map(int, input().split())
xs = list(map(int, input().split()))
ys = [0] * 100
for x in xs:
	ys[x - 1] += 1
m = 0
res = 0
count = 0
for x in ys:
	if x != 0:
		if x > m:
			res += count * (x - m)
			count += 1
			m = x
		elif x == m:
			count += 1
		else:
			res += m - x
			count += 1
if m % k != 0:
	res += ((m // k + 1) * k - m) * count
print(res)


from collections import Counter
from math import ceil
(n, d) = input().split()
n = int(n)
d = int(d)
x = list(map(int, input().split(' ')))
tupes = len(set(x))
most_com = Counter(x).most_common()[0][1]
print(ceil(most_com / d) * d * tupes - n)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
y = [0 for i in range(100)]
for i in range(n):
	y[x[i] - 1] += 1
p = 0
for i in range(100):
	if y[i] > p:
		p = y[i]
t = (p + k - 1) // k
r = 0
for i in range(100):
	if y[i] != 0:
		r += t * k - y[i]
print(r)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
r = [0] * 101
p = 0
for i in range(n):
	elem = m[i]
	if r[elem] == 0:
		p += 1
	r[elem] += 1
z = max(r)
if z % k == 0:
	d = z // k
else:
	d = z // k + 1
c = d * p * k
print(c - sum(r))


from math import ceil
(a, b) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
s = 0
for i in range(a):
	if c.count(c[i]) > s:
		s = c.count(c[i])
s2 = ceil(s / b)
d = len(set(c)) * b
print(s2 * len(set(c)) * b - a)


(a, b) = map(int, input().split())
mas = list(map(int, input().split()))
mast = []
masn = []
r = 0
i = 0
for i in range(a):
	if i == 0:
		mast.append(mas[0])
		masn.append(1)
		r += 1
	else:
		g = 0
		s = 0
		for g in range(r):
			if mast[g] == mas[i]:
				s = 1
				masn[g] += 1
		if s == 0:
			mast.append(mas[i])
			masn.append(1)
			r += 1
c = max(masn) // b
if max(masn) % b > 0:
	c += 1
print(c * r * b - a)


(n, k) = map(int, input().split())
M = list(map(int, input().split()))
T = [0] * 100
for i in range(n):
	T[M[i] - 1] += 1
(t, b) = (0, 0)
for i in range(100):
	if T[i] != 0:
		t += 1
		b = max(b, (T[i] + k - 1) // k)
print(b * t * k - n)


(n, k) = map(int, input().split())
t = list(map(int, input().split()))
e = []
for i in range(1, 101):
	if i in t:
		z = t.count(i)
		e.append(z)
q = max(e)
if q % k == 0:
	y = len(set(t))
	a = q / k
	print(int(y * a * k - n))
else:
	r = q // k + 1
	u = len(set(t))
	print(int(r * u * k - n))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = {}
for q in a:
	if q in s:
		s[q] += 1
	else:
		s[q] = 1
x = 0
d = sorted(s.items(), key=lambda h: h[1])
d.reverse()
f = d[0][1] // k
if d[0][1] / k > f:
	f += 1
for q in d:
	x += k * f - q[1]
print(x)


import math
np = input()
n = int(np.split(' ')[0])
p = int(np.split(' ')[1])
an = input()
nk = {}
for i in range(n):
	d = int(an.split(' ')[i])
	try:
		nk[d] = nk[d] + 1
	except:
		nk[d] = 1
max_n = 0
for i in nk.values():
	if i > max_n:
		max_n = i
dp = 0
if max_n % p == 0:
	for i in nk.values():
		dp = dp + max_n - i
	print(dp)
else:
	max_n = math.ceil(max_n / p) * p
	for i in nk.values():
		dp = dp + max_n - i
	print(dp)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
mas = [0] * 100
count = 0
for i in a:
	if mas[i - 1] == 0:
		count += 1
	mas[i - 1] += 1
bluda = math.ceil(max(mas) / k)
print(count * k * bluda - n)


(n, k) = [int(x) for x in input().split()]
a = {}
ostalos_prid = 0
for x in input().split():
	ostalos_prid += 1
	if x in a:
		a[x] += 1
	else:
		a[x] = 1

def ceil(x, d):
	if x % d == 0:
		return x // d
	else:
		return x // d + 1
kolvo_blud = ceil(max(a.values()), k)
vsego_prib = len(a.keys()) * kolvo_blud * k
res = vsego_prib - ostalos_prid
print(res)


def rou(num):
	if num % 1 == 0:
		return int(num)
	return int(num) + 1

def main():
	(n, k) = map(int, input().split())
	ls = [int(i) for i in input().split()]
	st = set()
	for i in ls:
		st.add(i)
	max = 0
	total = len(st) * k
	for j in st:
		if ls.count(j) > max:
			max = ls.count(j)
	if max > k:
		total = total * rou(max / k)
	print(total - n)
main()


import math
(n, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
d = [0] * (max(arr) + 1)
for i in range(len(arr)):
	d[arr[i]] += 1
max_ind = 0
max = -1
for i in range(len(d)):
	if d[i] > max:
		max = d[i]
		max_ind = i
target = math.ceil(max / k) * k
res = 0
for i in range(len(d)):
	if d[i] != 0:
		res += target - d[i]
print(res)


import math
(n, k) = input().split()
n = int(n)
k = int(k)
a = input().split()
b = set(a)
m = len(b)
maximal = 0
for item in b:
	if a.count(item) > maximal:
		maximal = a.count(item)
result = k * m * math.ceil(maximal / k) - len(a)
print(result)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
r = ceil(max((a.count(q) for q in a)) / k)
kind = len(set(a))
print(kind * r * k - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
cnt = [0] * 101
for i in range(n):
	cnt[a[i]] += 1
cnt.sort()
x = (cnt[-1] // k + (cnt[-1] % k > 0)) * k
y = 0
for i in range(101):
	y += bool(cnt[i])
print(x * y - n)


num = input().split(' ')
(n, k) = (int(num[0]), int(num[1]))
plates = [int(x) for x in input().split(' ')]
q = dict()
for elem in set(plates):
	q[elem] = plates.count(elem)
max_n = max(list(q.values()))
if max_n % k != 0:
	max_n += k - max_n % k
ans = 0
for elem in set(plates):
	ans += max_n - q[elem]
print(ans)


import math
(amount_of_tools, amount_of_guests) = (int(i) for i in input().split())
self_tools = [int(i) for i in input().split()]
array_for_comparison = []
for i in self_tools:
	array_for_comparison += [self_tools.count(i)]
amount_of_dishes = max(array_for_comparison)
amount_of_dishes = math.ceil(amount_of_dishes / amount_of_guests)
amount_of_different_tools = len(set(self_tools))
everything = amount_of_different_tools * amount_of_dishes * amount_of_guests
print(everything - amount_of_tools)


from math import ceil
a = [int(i) for i in input().split()]
n = a[0]
k = a[1]
del a
b = [int(i) for i in input().split()]
q = dict()
Max = 0
for i in b:
	q[i] = q.get(i, 0) + 1
	if q.get(i) > Max:
		Max = q.get(i)
del b
print(k * len(q) * ceil(Max / k) - n)


import math
(m, n) = map(int, input().split())
s = {}
for i in input().split():
	if i in s.keys():
		s[i] += 1
	else:
		s[i] = 1
print(math.ceil(max(s.values()) / n) * n * len(s.keys()) - m)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
cnt = [0] * 100
for elem in a:
	cnt[elem - 1] += 1
ans = 0
c = 0
for elem in cnt:
	c = max(c, ((elem - 1) // k + 1) * k)
for elem in cnt:
	if elem != 0:
		ans += c - elem
print(ans)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = max([a.count(q) for q in a])
m = len(set(a))
g = math.ceil(d / k)
print(m * g * k - n)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = {}
for item in a:
	try:
		b[item] += 1
	except:
		b[item] = 1
m_key = 0
m_value = 0
for (key, value) in b.items():
	if value > m_value:
		m_value = value
		m_key = key
count = ceil(m_value / k)
answer = count * k * len(b)
print(answer - n)


(n, k) = list(map(int, input().split()))
b = list(map(int, input().split()))
d = [0 for i in range(100)]
for i in b:
	d[i - 1] += 1
if max(d) % k == 0:
	m = max(d)
else:
	m = max(d) + (k - max(d) % k)
s = 0
for i in d:
	if i != 0:
		s += m - i
print(s)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * 100
for i in a:
	b[i - 1] += 1
bound = max(b)
if bound % k != 0:
	bound += k - bound % k
res = 0
for i in b:
	if i != 0:
		res += bound - i
print(res)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
hashmap = {}
maxCount = 0
for item in arr:
	if item in hashmap:
		hashmap[item] += 1
		maxCount = max(maxCount, hashmap[item])
	else:
		hashmap[item] = 1
priborInFood = len(hashmap)
priborPodacha = priborInFood * k
res = 0
allPribor = priborPodacha
i = 0
while maxCount > 0:
	i = i + 1
	maxCount = maxCount - k
if i == 0:
	i = 1
res = priborPodacha * i - n
print(res)


(n, k) = input().split()
n = int(n)
k = int(k)
dish = 0
result = 0
Utensils = input().split(maxsplit=n - 1)
for i in range(n):
	Utensils[i] = int(Utensils[i])
Type = ''
for i in range(101):
	if i == 100:
		Type += '0'
	else:
		Type += '0 '
Type = Type.split(maxsplit=100)
for i in Utensils:
	for j in range(101):
		Type[j] = int(Type[j])
		if i == j:
			Type[j] += 1
checksum = max(Type)
if checksum < k or checksum == k:
	dish = 1
else:
	dish = checksum // k
	if not checksum % k == 0:
		dish += 1
checksum = dish * k
for i in Type:
	if not i == 0:
		result += checksum - i
print(result)


s = input().split()
tree = {}
n = int(s[0])
k = int(s[1])
ma = -1
s = input().split()
for i in range(n):
	if tree.__contains__(s[i]):
		tree[s[i]] += 1
	else:
		tree[s[i]] = 1
for i in tree.keys():
	ma = max(ma, tree[i])
deesh = 0
if ma % k == 0:
	deesh = ma // k
else:
	deesh = ma // k + 1
sum = k * len(tree.keys()) * deesh
print(sum - n)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
max = 0
count = [0] * 100
for i in range(n):
	count[lst[i] - 1] += 1
	if count[lst[i] - 1] > max:
		max = count[lst[i] - 1]
hanged = max
if max % k != 0:
	hanged += (max // k + 1) * k - max
ans = 0
for i in range(100):
	if count[i] == 0:
		continue
	ans += hanged - count[i]
print(ans)


import math
(n, k) = map(int, input().split(' '))
arr = list(map(int, input().split(' ')))
print(math.ceil(max([arr.count(i) for i in arr]) / k) * len(set(arr)) * k - n)


import math
(residue, guests) = map(int, input().split())
cutlery = list(input().split())
number = len(set(cutlery))
maxim = []
for i in set(cutlery):
	maxim.append(cutlery.count(i))
number_of_fork = max(maxim)
receptions = math.ceil(number_of_fork / guests)
print(receptions * number * guests - residue)


from sys import stdin, stdout, setrecursionlimit
from gc import disable
from math import ceil
disable()
gets = input
puts = print
input = stdin.readline
print = stdout.write

def main() -> int:
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = set(a)
	m = 0
	for i in s:
		m = m if m > a.count(i) else a.count(i)
	b = ceil(m / k)
	count = 0
	bk = b * k
	for i in s:
		count += bk - a.count(i)
	puts(count)
	return 0
main()


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
d = [0] * 101
for i in range(a):
	d[c[i]] += 1
e = max(d)
f = e
g = 0
for i in range(101):
	if d[i] != 0:
		f = min(f, d[i])
		g += 1
h = (e + b - 1) // b
ans = h * g * b - a
print(ans)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
cnt = {}
maxcnt = -1
for item in a:
	if item not in cnt:
		cnt[item] = 1
	else:
		cnt[item] += 1
base = 0
for item in cnt:
	if maxcnt < cnt[item]:
		maxcnt = cnt[item]
for i in range(1, maxcnt + 1, k):
	base += k * len(cnt)
base -= n
print(base)


listelem = [int(num) for num in input().split()]
(n, key) = (listelem[0], listelem[1])
cccc = [int(ooo) for ooo in input().split()]
ddddd = dict()
for ccc in cccc:
	ddddd[ccc] = ddddd.get(ccc, 0) + 1
minimal = max(ddddd.values())
count = minimal // key
if minimal % key != 0:
	count += 1
print(count * len(ddddd) * key - n)


(n, k) = map(int, input().split())
A = [int(s) for s in input().split()]
a = 0
food = 1
for i in A:
	if (A.count(i) - 1) // k + 1 > food:
		food = (A.count(i) - 1) // k + 1
R = []
for i in A:
	if i not in R:
		a += k * food - A.count(i)
	R.append(i)
print(a)


from collections import Counter
(cnt, g) = [int(i) for i in input().split()]
in_arr = [int(i) for i in input().split()]
cnt_b = 0
d = dict(Counter(in_arr))
m = max(d.values())
if m // g * g == m:
	cnt_b = m // g
else:
	cnt_b = m // g + 1
print(cnt_b * g * len(d.keys()) - cnt)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
	if a[i] not in b:
		b.append(a[i])
cutl = len(b)
c = [0] * cutl
for i in range(len(b)):
	c[i] = a.count(b[i])
maxType = max(c)
types = 0
if maxType % k == 0:
	types = maxType // k
else:
	types = maxType // k + 1
qual = types * cutl * k
print(qual - n)


w = list(map(int, input().split()))
p = list(map(int, input().split()))
a = w[0]
v = w[1]
s = set()
m = set()
g = [0]
for i in range(100):
	s.add(i + 1)
	g.append(0)
for j in range(len(p)):
	g[p[j]] = g[p[j]] + 1
	m.add(p[j])
m.intersection(s)
t = len(m)
h = max(g)
h = (h + v - 1) // v
print(h * v * t - a)


from collections import Counter
(n, k) = map(int, input().split(' '))
utensils = Counter(input().split(' '))
max_utensils = max(list(map(int, list(utensils.values()))))
min_dishes = int(max_utensils / k) if max_utensils % k == 0 else int(max_utensils / k) + 1
print(min_dishes * k * len(utensils) - n)


(n, k) = map(int, input().split())
a = [int(e) for e in input().split()]
q = dict()
mx = len(set(a))
res = 0
m = 1
for i in a:
	q[i] = q.get(i, 0) + 1
for i in a:
	if q[i] > k and int(q[i] / k) >= m:
		m = q[i] / k
		if int(m) < m:
			m = int(m) + 1
		else:
			m = int(m)
mx = m * mx * k
print(mx - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = [0] * 100
for i in range(len(a)):
	l[a[i] - 1] += 1
kn = (max(l) + k - 1) // k
ans = 0
for i in range(len(l)):
	if l[i] != 0:
		ans += kn * k - l[i]
print(ans)


from collections import *
R = lambda : map(int, input().split())
(n, k) = R()
a = Counter(R())
print(-max(a.values()) // k * -k * len(a) - n)


(n, k) = map(int, input().split())
r = 0
mx = 0
s = input().split()
d = dict()
for i in range(n):
	if int(s[i]) in d:
		d[int(s[i])] += 1
	else:
		d[int(s[i])] = 1
		r += 1
for i in d.keys():
	if mx < d[i]:
		mx = d[i]
if mx % k == 0:
	b = mx // k
else:
	b = mx // k + 1
print(b * k * r - n)


(n, k) = map(int, input().split())
l1 = list(map(int, input().split()))
l_n = []
l2 = []
for i in l1:
	if i not in l_n:
		l_n.append(i)
		l2.append(l1.count(i))
z = max(l2) // k + (max(l2) % k != 0)
print(z * len(l2) * k - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
maxs = -1
for i in range(n):
	if a.count(a[i]) % k != 0:
		maxs = max(maxs, a.count(a[i]) // k + 1)
	else:
		maxs = max(maxs, a.count(a[i]) // k)
print(k * maxs * len(set(a)) - n)


(n, k) = map(int, input().split())
pr = input().split()
s = 0
pr1 = set(pr)
pr1 = list(pr1)
bl = None
for i in range(len(pr1)):
	if pr.count(pr1[i]) > s:
		s = pr.count(pr1[i])
if s > k:
	while s % k != 0:
		s += 1
	bl = s // k
elif s <= k:
	bl = 1
prib = len(pr1)
print(bl * prib * k - n)


from math import ceil
readints = lambda : map(int, input().strip('\n').split())
(n, k) = readints()
utensils = list(readints())
freq = {}
for u in utensils:
	if u not in freq:
		freq[u] = 0
	freq[u] += 1
uPerEntry = len(freq)
numEntries = ceil(max(list(freq.values())) / k)
total = numEntries * k * uPerEntry
ans = total - n
print(ans)


def error():
	print('Bad input.')
	exit()
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
test = {1: n not in range(1, 101), 2: k not in range(1, 101), 3: n != len(a), 4: any([i not in range(1, 101) for i in a])}
if any(test.values()):
	error()
kol = 1
ra = {key: a.count(key) for key in set(a)}
if max(ra.values()) > k:
	if max(ra.values()) % k == 0:
		kol += max(ra.values()) // k - 1
	else:
		kol += max(ra.values()) // k
print(kol * k * len(set(a)) - n)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
A = [0] * 101
B = list(map(int, input().split()))
for i in range(0, n):
	A[B[i]] += 1
u = max(A)
if u % k != 0:
	pribory = (u // k + 1) * k
else:
	pribory = u
sum = 0
for i in range(0, 101):
	if A[i] != 0:
		sum += pribory - A[i]
print(sum)


(a, b) = map(int, input().split())
d = {}
s = input().split()
for i in s:
	d[i] = d.get(i, 0) + 1
l = 0
mx = max(d.values())
if mx % b == 0:
	s = mx // b
else:
	s = mx // b + 1
su = 0
for i in d:
	su += s * b - d[i]
print(su)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
l = []
for i in range(len(a)):
	if d.get(a[i]) is None:
		l.append(a[i])
		d[a[i]] = 1
	else:
		d[a[i]] += 1
m = 0
for i in range(len(l)):
	m = max(m, d[l[i]])
dish = math.ceil(m / k)
print(dish * k * len(l) - n)


import math
from collections import Counter
(n, k) = map(int, input().split())
s = input() + ' '
s1 = ''
mas = []
newmas = []
c = 0
for i in range(len(s)):
	if s[i] != ' ':
		s1 = s1 + s[i]
	else:
		mas.append(s1)
		s1 = ''
d = Counter(mas)
for i in range(len(mas)):
	j = mas[i]
	c1 = d[str(j)]
	if c1 > c:
		c = c1
for i in mas:
	if i not in newmas:
		newmas.append(i)
r = len(newmas) * k * math.ceil(c / k) - n
print(r)


spisok = [int(number) for number in input().split()]
(n, k) = (spisok[0], spisok[1])
cc = [int(o) for o in input().split()]
d = dict()
for c in cc:
	d[c] = d.get(c, 0) + 1
m = max(d.values())
nb = m // k
if m % k != 0:
	nb += 1
print(nb * len(d) * k - n)


import math
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
arr.append(999)
dic = {}
count = 1
for i in range(n):
	if arr[i] == arr[i + 1]:
		count += 1
	else:
		dic[arr[i]] = count
		count = 1
arr2 = []
for (b, a) in dic.items():
	arr2.append([a, b])
arr2 = sorted(arr2, reverse=True)
t = math.ceil(arr2[0][0] / k)
print(len(arr2) * k * t - n)


(n, k) = input().split()
n = int(n)
k = int(k)
a = input().split()
for i in range(0, n):
	a[i] = int(a[i])
c = set(a)
f = max(a) * [0]
for i in range(0, n):
	for j in range(1, len(f) + 1):
		if a[i] == j:
			f[j - 1] += 1
i = 0
while i < len(f):
	if f[i] == 0:
		f.remove(f[i])
	else:
		i += 1
b = (max(f) + k - 1) // k
print(len(f) * b * k - sum(f))


(n, k) = map(int, input().split())
pr = [int(i) for i in input().split()]
mur = []
for i in range(n):
	if pr.index(pr[i]) == i:
		mur.append(pr.count(pr[i]))
if max(mur) % k == 0:
	meow = k * (max(mur) // k)
else:
	meow = k * (max(mur) // k + 1)
otvet = 0
for i in range(len(mur)):
	otvet += meow - mur[i]
print(otvet)


(n, k) = map(int, input().split())
from collections import Counter as ct
d = ct(input().split())
print(len(d) * k * ((max(d.values()) + k - 1) // k) - n)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	(n, k) = Mint()
	a = List()
	b = Counter(a)
	l = len(b)
	m = max(b.values())
	ans = ceil(m / k) * l * k - n
	print(ans)
solution()


k = input().split()
(n, k) = (int(k[0]), int(k[1]))
a = list(map(int, input().split()))
b1 = [0 for i in range(100)]
b2 = [True for i in range(100)]
c = 0
d = 1
p = 0
for i in a:
	b1[i - 1] += 1
	if b2[i - 1]:
		p += 1
		b2[i - 1] = False
d = (max(b1) - 1) // k + 1
print(d * p * k - n)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = {}
for i in range(n):
	if a[i] not in b.keys():
		b.__setitem__(a[i], 1)
	else:
		b[a[i]] += 1
t = math.ceil(max(b.values()) / k) * k
sum = 0
for i in b.values():
	sum += t - i
print(sum)


(n, k) = map(int, input().split())
items = list(map(int, input().split()))
v_counts = dict()
max_left = -1
for i in range(n):
	if items[i] in v_counts:
		v_counts[items[i]] += 1
	else:
		v_counts[items[i]] = 1
	if max_left < v_counts[items[i]]:
		max_left = v_counts[items[i]]
dish_cnt = max_left // k + (max_left % k > 0)
print(dish_cnt * len(v_counts) * k - n)


def main():
	(silverware, guests) = map(int, input().split())
	what_is_left = list(map(int, input().split()))
	sets = [set() for k in range(guests)]
	unique = set()
	courses = guests
	for k in range(silverware):
		unique.add(what_is_left[k])
		j = 0
		while what_is_left[k] in sets[j]:
			j += 1
			if j >= courses:
				sets.extend([set() for k in range(guests)])
				courses += guests
				break
		sets[j].add(what_is_left[k])
	missing = 0
	for st in sets:
		missing += len(unique - st)
	print(missing)
main()


import math
(n, k) = map(int, input().split())
items = {}
maxc = 0
for i in map(int, input().split()):
	if i in items:
		items[i] += 1
	else:
		items[i] = 1
	if items[i] > maxc:
		maxc = items[i]
count = math.ceil(maxc / k)
p = count * k * len(items)
print(p - n)


import math
(n, k) = list(map(int, input().split(' ')))
data = list(map(int, input().split(' ')))
specdata = []
for i in data:
	if not i in specdata:
		specdata.append(i)
ds = []
for c in specdata:
	ds.append(data.count(c))
maxim = max(ds)
print(len(specdata) * k * math.ceil(maxim / k) - n)


(dl, pa) = map(int, input().split())
dish = input().split()
dish.sort()
a = dish[0]
size = []
count = 0
for i in dish:
	if a == i:
		count += 1
	else:
		size.append(count)
		count = 1
		a = i
size.append(count)
val = max(size)
if val % pa == 0:
	dpp = val // pa
else:
	dpp = val // pa + 1
count = 0
for i in size:
	count = count + (dpp * pa - i)
print(count)


(n, k) = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
types = {}
for t in T:
	types[t] = types.setdefault(t, 0) + 1
count = len(types)
J = max(list(types.values())) // k + (1 if max(list(types.values())) % k != 0 else 0)
print(count * J * k - n)


(n, k) = input().split()
(n, k) = (int(n), int(k))
b = input().split()
for i in range(len(b)):
	b[i] = int(b[i])
a = []
for i in range(100):
	a.append(0)
for i in b:
	a[i - 1] += 1
sumP = 0
maxP = 0
count = 0
for i in a:
	sumP += i
	if i != 0:
		count += 1
	if i > maxP:
		maxP = i
n = maxP // k
if maxP % k != 0:
	n += 1
print(count * n * k - sumP)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
sets = list(set(s))
m = s.count(sets[0])
for el in sets[1:]:
	if s.count(el) > m:
		m = s.count(el)
if m % k == 0:
	n_set = m // k
else:
	n_set = m // k + 1
need_of_a_kind = k * n_set
sch = 0
for el in sets:
	c = s.count(el)
	if c < need_of_a_kind:
		sch += need_of_a_kind - c
print(sch)


(n, k) = map(int, input().split())
s = input().split()
g = 0
for each in s:
	if g < s.count(each):
		g = s.count(each)
i = 1
if g % k == 0:
	i = g // k
else:
	i = g // k + 1
print(i * k * len(set(s)) - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = dict()
for i in a:
	d[i] = d.get(i, 0) + 1
max_bluda = 1
for i in d:
	if d[i] > k:
		max_bluda = max(max_bluda, (d[i] + k - 1) // k)
print(max_bluda * len(d) * k - n)


(n, k) = map(int, input().split())
tools = list(map(int, input().split()))
count_tools = {}
for tool in tools:
	count_tools[tool] = count_tools.get(tool, 0) + 1
key = lambda x: x[1]
maximum = max(count_tools.items(), key=key)[1]
if maximum % k != 0:
	dishes = maximum // k + 1
else:
	dishes = maximum // k
print(k * len(set(tools)) * dishes - n)


(n, k) = input().split()
(n, k) = (int(n), int(k))
d = {}
stolen = 0
pr = input().split()
for i in pr:
	a = d.get(i, -1)
	if a == -1:
		d[i] = 1
	else:
		d[i] += 1
values = d.values()
b = max(values)
dishes = (b - 1) // k + 1
prib_max = dishes * k
for i in values:
	stolen += prib_max - i
print(stolen)


(n, k) = map(int, input().split())
d = {}
for i in input().split():
	j = int(i)
	if j in d:
		d[j] += 1
	else:
		d[j] = 1
mx = max(d.values())
b = (mx + k - 1) // k
print(b * k * len(set(d.keys())) - n)


b = []
(ind, sum, egg) = (0, 0, 2)
(n, k) = map(int, input().split())
b = input().split()
b = [int(i) for i in b]
b.sort()
while ind < len(b):
	a = b.count(b[ind])
	ind += b.count(b[ind])
	sum += k - a
	if k - a < 0:
		k = k * egg / (egg - 1)
		egg += 1
		ind = 0
		sum = 0
		continue
	sum = int(sum)
print(sum)


(n, k) = input().split()
n = int(n)
k = int(k)
a = input().split()
mn = set(a)
m = len(mn)
maxelem = 0
w = 0
for elem in a:
	if elem != w:
		e = a.count(elem)
		if maxelem < e:
			maxelem = int(e)
		w = elem
if maxelem % k != 0:
	q = (maxelem // k + 1) * k * m
else:
	q = maxelem * m
print(q - n)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
cnt = [0 for i in range(101)]
for x in a:
	cnt[x] += 1
ans = 0
maxi = 0
for x in range(1, 101):
	maxi = max(maxi, (cnt[x] + k - 1) // k)
for x in range(1, 101):
	if cnt[x] > 0:
		ans += maxi * k - cnt[x]
print(ans)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [0] * 101
for i in a:
	b[i] += 1
c = max(b)
if c % k != 0:
	c = c - c % k + k
s = 0
for i in b:
	if i != 0:
		s += c - i
print(s)


a = input()
b = input()
a = a.split()
b = b.split()
a[0] = int(a[0])
a[1] = int(a[1])
c = set(b)
c = list(c)
dmax = 0
for i in range(len(c)):
	d = b.count(c[i])
	if d > dmax:
		dmax = d
if dmax % a[1] != 0:
	d = (dmax // a[1] + 1) * a[1]
else:
	d = dmax // a[1] * a[1]
s = len(c) * d - a[0]
print(s)


(n, k) = [int(i) for i in input().split()]
m = [0] * 101
maxx = 0
count = 0
for i in input().split():
	i = int(i)
	if m[i] == 0:
		count += 1
	m[i] += 1
	if m[i] > maxx:
		maxx = m[i]
if maxx % k == 0:
	al = maxx // k * count * k
else:
	al = (maxx // k + 1) * count * k
print(al - n)


temp = list(map(int, input().split()))
n = list(map(int, input().split()))
st = list(set(n))
mx = 0
k = temp[1]
for i in st:
	t = n.count(i)
	if mx < t:
		mx = t
i = 1
while mx > i * k:
	i += 1
m = k * i * len(st) - len(n)
print(m)


a = input().split()
n = int(a[0])
k = int(a[1])
st = input().split()
sp = {}
for i in st:
	if i in sp.keys():
		sp[i] += 1
	else:
		sp[i] = 1
mx = 0
col = len(sp)
s1 = []
for i in sp.keys():
	s1 += [sp[i]]
mx = max(s1)
while mx % k != 0:
	mx += 1
mn = mx / k
cl = col * int(k) * mn
res = cl - int(n)
print(int(res))


(n, k) = list(map(int, input().split()))
prib = list(map(int, input().split()))
prib.sort()
I = 0
p = []
while I < n:
	a = prib[I]
	p.append(0)
	while I < n and a == prib[I]:
		I += 1
		p[-1] += 1
p.sort()
l = (p[-1] - 1) // k + 1
l *= k
ans = 0
for i in p:
	ans += l - i
print(ans)


(rest, people) = map(int, input().split())
types = list(map(int, input().split()))
a = dict()
for elem in types:
	if elem in a:
		a[elem] += 1
	else:
		a[elem] = 1
maximum = 0
for key in a:
	if a[key] > maximum:
		maximum = a[key]
needed = maximum
while needed % people != 0:
	needed += 1
ans = 0
for key in a:
	ans += needed - a[key]
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = dict()
for i in a:
	if i not in d.keys():
		d[i] = 1
	else:
		d[i] += 1
mx = 0
for i in d.values():
	mx = max(mx, (i + k - 1) // k)
ans = 0
for i in d.values():
	ans += mx * k - i
print(ans)


(n, g) = map(int, input().split())
mass = [g] * 101
ans = 0
inp = list(map(int, input().split()))
for i in inp:
	mass[i] -= 1
x = 0
if min(mass) < 0:
	x = min(mass) // g
for i in mass:
	if i != g:
		ans += i - x * g
print(ans)


(a, b) = map(int, input().split())
c = [int(i) for i in input().split()]
c.sort()
bl = 1
bla = 1
for i in range(1, len(c)):
	if c[i] == c[i - 1]:
		bla += 1
		if bla > bl:
			bl = bla
	else:
		bla = 1
bl = (bl - 1) // b + 1
print(len(set(c)) * bl * b - a)


import math
import bisect
import collections
import itertools
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd, Counter as ctr
from bisect import bisect_left as bl, bisect_right as br
from itertools import permutations as pr, combinations as cb
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))

def results(arr, k):
	tmp = ctr(arr)
	q = max(tmp.values())
	p = q // k
	if q % k:
		p += 1
	p = p * k * len(tmp)
	return p

def main():
	nk = seq()
	a = seq()
	(n, k) = (nk[0], nk[1])
	print(results(a, k) - n)
main()


(n, k) = input().split()
n = int(n)
k = int(k)
dict1 = {}
inp = list(map(int, input().split()))
for i in inp:
	if dict1.get(i, 0) == 0:
		dict1[i] = 1
	else:
		dict1[i] += 1
maxp = 0
for i in dict1.values():
	if i > maxp:
		maxp = i
if float(maxp / k) > float(int(maxp / k)):
	meals = int(maxp / k) + 1
else:
	meals = int(maxp / k)
count = 0
for i in dict1.keys():
	count += 1
print(count * meals * k - n)


(a, d) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = []
b = 0
C = []
for i in range(a):
	if A[i] not in B:
		b += 1
		B.append(A[i])
		C.append(A.count(A[i]))
c = max(C)
x = c // d
if c % d != 0:
	x += 1
print(b * x * d - a)


arr = list()
s = set()
for i in range(100):
	arr.append(0)
(n, k) = list(map(lambda x: int(x), input().split(' ')))
for i in list(map(lambda x: int(x), input().split(' '))):
	arr[i - 1] += 1
	s.add(i)
l = (max(arr) - 1) // k + 1
print(l * len(s) * k - n)


spisok = [int(number) for number in input().split()]
(u, h) = (spisok[0], spisok[1])
o = [int(o) for o in input().split()]
d = dict()
for c in o:
	d[c] = d.get(c, 0) + 1
MAX = max(d.values())
y = MAX // h
if MAX % h != 0:
	y += 1
print(y * len(d) * h - u)


inp = [int(i) for i in input().split()]
(n, k) = (inp[0], inp[1])
inp = [int(i) for i in input().split()]
dict = {}
for i in inp:
	if i in dict:
		dict[i] += 1
	else:
		dict[i] = 1
values = list(dict.values())
max = 0
for i in values:
	if i > max:
		max = i
dish = (max + k - 1) // k
result = len(values) * dish * k
print(result - n)


s = input().split()
n = int(s[0])
k = int(s[1])
s = input().split()
d = {}
for i in set(s):
	d[int(i)] = 0
li = [int(i) for i in s]
for i in li:
	d[i] += 1
m = max(d.values())
res = 0
if m % k != 0:
	m = (m // k + 1) * k
for i in d.values():
	res += m - i
print(res)


import sys
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
dic = dict()
for i in arr:
	dic[i] = dic.get(i, 0) + 1
value = sorted(dic, key=lambda x: dic[x], reverse=True)
i = 1
check = dic[value[0]]
while True:
	if i * k >= check:
		break
	i += 1
values = list(dic.values())
print(i * k * len(values) - len(arr))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
x = list(set(arr))
count = 0
for i in x:
	temp = arr.count(i)
	if temp > count:
		count = temp
if count % k == 0:
	count = count // k
else:
	count = count // k + 1
total = count * len(x) * k
print(total - n)


import math
(n, k) = map(int, input().split())
prb = []
for i in range(101):
	prb.append(0)
prib = list(map(int, input().split()))
for i in range(len(prib)):
	prb[prib[i]] += 1
res = 0
blud = 1
if max(prb) > k:
	blud = max(prb) / k
	blud = math.ceil(blud)
for i in range(len(prb)):
	if prb[i] == 0:
		continue
	else:
		res += blud * k - prb[i]
print(res)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
x = max((a.count(i) for i in a))
x += (k - x % k) % k
ans = 0
d = []
for i in a:
	if i not in d:
		ans += x - a.count(i)
		d.append(i)
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = [0] * 101
for i in a:
	s[i] += 1
m = max(s)
b = m // k + (1 if m // k * k < m else 0)
p = b * k
u = 0
for i in range(101):
	if s[i] > 0:
		u += p - s[i]
print(u)


(n, k) = map(int, input().split(' '))
arr = list(map(int, input().split(' ')))
s = set(arr)
l = len(s)
m = 0
for i in arr:
	count = arr.count(i)
	if count > m:
		m = count
dishes = (m + k - 1) // k
print(dishes * l * k - n)


import math
(n, k) = map(int, input().split())
a = input().split()
items = set(a)
count = 0
answ = 0
for item in items:
	if a.count(item) > count:
		count = a.count(item)
max = math.ceil(count / k) * k
for item in items:
	answ += max - a.count(item)
print(answ)


n = input().split()
pr = input().split()
max1 = 0
k = 0
b = set()
c = 0
for i in pr:
	b.add(i)
	if pr.count(i) > max1:
		max1 = pr.count(i)
bl = 0
while c < max1:
	bl += 1
	c = bl * int(n[1])
k = bl * len(b) * int(n[1]) - int(n[0])
print(k)


import math
(n, k) = map(int, input().split())
a = [int(t) for t in input().split()]
d = {}
for i in a:
	if d.get(i) is None:
		d[i] = 0
	d[i] += 1
print(math.ceil(max(d.values()) / k) * len(d.keys()) * k - n)


(n, m) = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()
d = {}
for i in range(1, 101):
	d[i] = 0
s = 0
for i in range(n):
	d[l[i]] += 1
	s = s + 1
pr = 0
for i in d:
	if d[i] != 0:
		pr += 1
smax = 0
for i in d:
	if d[i] > smax:
		smax = d[i]
if smax % m == 0:
	bl = smax // m
else:
	bl = smax // m + 1
print(max(bl * m * pr - s, 0))


(n, k) = map(int, input().split())
a = [int(x) - 1 for x in input().split()]
s = [0] * 100
for i in range(n):
	s[a[i]] += 1
m = max(s)
if m % k != 0:
	m += k - m % k
print(sum([m - s[i] for i in range(100) if s[i] != 0]))


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
q = [1000 for i in range(100)]
w = [0 for i in range(100)]
s = 0
for i in a:
	if q[i - 1] == 1000:
		q[i - 1] = 1
	else:
		q[i - 1] = q[i - 1] + 1
	w[i - 1] += 1
if max(w) % k == 0:
	m = max(w) // k
else:
	m = max(w) // k + 1
for i in range(100):
	if w[i] != 0:
		s += k * m - w[i]
print(s)


from collections import Counter
import math
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
c = Counter(arr)
common = c.most_common(1)[0][1]
print(math.ceil(common / k) * len(c) * k - len(arr))


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
counts = [0] * 101
for i in range(n):
	counts[l[i]] += 1
if max(counts) % k != 0:
	amount = (max(counts) + k) // k * k
else:
	amount = max(counts)
ans = 0
for i in range(1, 101):
	if counts[i] != 0:
		ans += amount - counts[i]
print(ans)


(n, k) = map(int, input().split())
prib_arr = list(map(int, input().split()))
prib_dict = {}
for i in range(n):
	if prib_arr[i] in prib_dict:
		prib_dict[prib_arr[i]] += 1
	else:
		prib_dict[prib_arr[i]] = 1
pribs = max([prib_dict[i] for i in prib_dict])
pribs = (pribs // k + (pribs % k > 0)) * k
ans = 0
for a in prib_dict:
	ans += pribs - prib_dict[a]
print(ans)


inp = input().split(' ')
n = int(inp[0])
k = int(inp[1])
a = [int(i) for i in input().split(' ')]

def ln(x, y):
	count = 0
	for i in y:
		if i == x:
			count += 1
	return count
maxcount = 0
for i in range(1, 101):
	if ln(i, a) > maxcount:
		maxcount = ln(i, a)
bluda = maxcount // k
if maxcount % k != 0:
	bluda += 1
excl = []
for i in a:
	if not i in excl:
		excl.append(i)
nab = len(excl) * k * bluda
print(nab - n)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
prib = set(lst)
maxcount = k
b = 1
for elem in prib:
	num = lst.count(elem)
	while num > maxcount:
		maxcount += k
		b += 1
print(b * len(prib) * k - n)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = set(a)
dct = dict()
for x in a:
	if x in dct:
		dct[x] += 1
	else:
		dct[x] = 1
b = ceil(max(dct.values()) / k)
rn = len(s) * b * k
print(rn - n)


import math
(n, k) = input().split()
(n, k) = (int(n), int(k))
s = input().split()
S = [int(i) for i in s]
S.sort()
c = 1
M = []
for i in range(n - 1):
	if S[i] == S[i + 1]:
		c = c + 1
		M.append(c)
	else:
		M.append(c)
		c = 1
p = 1
for i in range(n - 1):
	if S[i] != S[i + 1]:
		p = p + 1
if not M:
	x = 1
else:
	x = max(M)
y = math.ceil(x / k)
a = k * y * p
print(a - n)


(left_count, num_people) = input().split()
num_people = int(num_people)
left = input().split()
left1 = set(left)
x = max([left.count(i) for i in left1])
if x % num_people == 0:
	num_dishes = x // num_people
else:
	num_dishes = x // num_people + 1
print(num_people * len(left1) * num_dishes - int(left_count))


import math
import sys
bb = []
tt = 1
schet = 0
check = 0
(n, k) = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
for i in range(n):
	if b[i] not in bb:
		bb.append(b[i])
		schet += 1
		if check <= b.count(b[i]):
			check = b.count(b[i])
ttt = k * schet
check2 = check * schet
while check2 > ttt * tt:
	tt = tt + 1
print(ttt * tt - n)


(k, n) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = []
b.append(a.count(a[0]))
for i in range(1, k):
	if a[i] != a[i - 1]:
		b.append(a.count(a[i]))
b.sort()
if b[-1] / n == b[-1] // n:
	nn = b[-1] // n
else:
	nn = b[-1] // n + 1
print(nn * n * len(b) - sum(b))


from collections import defaultdict, Counter
(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
c = Counter()
data = defaultdict(list)
for i in range(1, k + 1):
	data[i]
for x in a:
	c[x] += 1
	for f in data.keys():
		if x not in data[f]:
			data[f].append(x)
			break
maxValue = -1
for d in data.keys():
	if len(data[d]) > maxValue:
		maxValue = len(data[d])
mostCommon = c.most_common(1)[0][1]
numberOfP = 0
for i in range(mostCommon, mostCommon + k):
	if i % k == 0:
		numberOfP = i
		break
kitsPerPerson = numberOfP // k
allP = maxValue * (k * kitsPerPerson)
print(allP - n)


a = [int(s) for s in input().split()]
(n, k) = (a[0], a[1])
things = [int(s) for s in input().split()]
a = {}
for thing in things:
	if thing not in a:
		a[thing] = 1
	else:
		a[thing] += 1
max_a = max(a.values())
compl = (max_a + k - 0.5) // k * k
print(int(compl * len(a)) - n)


(n, k) = map(int, input().split())
ar = list(map(int, input().split()))
count = [0] * 100
const = 0
for i in range(len(ar)):
	count[ar[i] - 1] += 1
if max(count) % k == 0:
	const = max(count) // k
else:
	const = max(count) // k + 1
ans = 0
for i in range(len(count)):
	if count[i] != 0:
		ans += const * k - count[i]
print(ans)


(n, k) = list(map(int, input().split()))
d = {}
s = input().split()
for i in s:
	d[i] = d.get(i, 0) + 1
e = max([d[i] for i in d.keys()])
w = e // k + int(e % k != 0)
print(w * k * len(d.keys()) - sum([d[i] for i in d.keys()]))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
ans = 0
for i in range(1, 101):
	if a.count(i) > 0:
		b.append(a.count(i))
c = max(b)
if c % k:
	while c % k:
		c += 1
for i in b:
	ans += c - i
print(ans)


from math import *
(n, k) = map(int, input().split())
pribory = list(map(int, input().split()))
_type = []
_val = []
for i in pribory:
	if i in _type:
		_val[_type.index(i)] += 1
	else:
		_type.append(i)
		_val.append(1)
nabor = 1
for i in range(len(_val)):
	if _val[i] > k and ceil(_val[i] / k) > nabor:
		nabor = ceil(_val[i] / k)
_max = 0
for i in _val:
	if i < k * nabor:
		_max += k * nabor - i
print(_max)


import collections
n = list(map(int, input().split()))
a = list(map(int, input().split()))
a = collections.Counter(a)
m = a.most_common(1)[0][1]
while m % n[1] != 0:
	m += 1
count = 0
for i in a:
	count += m - a[i]
print(count)


from collections import Counter
from math import ceil
(n, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
num = [0] * 100
for i in arr:
	num[i - 1] += 1
num.sort()
mx = num[-1]
a = ceil(mx * 1.0 / k)
t = a * k
s = 0
for i in range(len(num) - 1, -1, -1):
	if num[i] == 0:
		break
	elif num[i] < t:
		s += t - num[i]
print(s)


def ii(x):
	if x % 1 == 0:
		return x
	return int(x) + 1
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
count = dict()
eat = 0
all_pr = 0
ans = 0
for i in arr:
	if i not in count:
		count[i] = 1
	else:
		count[i] += 1
for i in count.items():
	dell = i[1] / k
	eat = max(eat, dell)
eat = ii(eat)
all_pr = eat * k * len(count)
stilled = sum(count.values())
ans = all_pr - stilled
print(int(ans))


from collections import Counter
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
kolpr = len(set(a))
di = Counter(a)
maxx = di.most_common()[0][-1]
minn = di.most_common()[-1][-1]
kolbl = (maxx + k - 1) // k
ans = 0
allpr = kolbl * kolpr * k
print(allpr - len(a))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ll = list()
for i in l:
	if i not in ll:
		ll.append(i)
y = 0
b = 1
for i in ll:
	x = l.count(i)
	if x / b > k:
		b = x / k
		if b % 1 != 0:
			b += 1
			b //= 1
for i in ll:
	y += b * k - l.count(i)
print(int(y))


import math
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
st = set(arr)
t = len(st)
x = max(arr, key=arr.count)
mxcnt = arr.count(x)
y = math.ceil(mxcnt / k)
r1 = t * y * k
print(r1 - n)


import math
(n, k) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
a.sort()
c = []
for i in range(1, 101):
	c.append(a.count(i))
bl = math.ceil(max(c) / k)
ans = 0
for i in c:
	if i != 0:
		ans += bl * k - i
print(ans)


import math
(n, k) = [int(i) for i in input().split()]
mas = [int(i) for i in input().split()]
min1 = -999999
mas1 = []
for i in range(0, 101):
	mas1.append(0)
for i in range(0, n):
	x = mas[i]
	mas1[x] += 1
for i in range(0, len(mas1)):
	if mas1[i] > 0 and mas1[i] > min1:
		min1 = mas1[i]
mas = set(mas)
z = len(mas)
min1 = math.ceil(min1 / k)
print(z * k * min1 - n)


import math
sk = 0
max = 0
(vid, gost) = map(int, input().split())
prib = list(input().split())
k = [0 for i in range(101)]
for i in range(len(prib)):
	k[int(prib[i])] += 1
for i in range(len(k)):
	if k[i] > max:
		max = k[i]
	if k[i] != 0:
		sk += 1
if max >= gost:
	kol = max / gost
	if kol % 1 != 0:
		kol = int(kol) + 1
	kol = int(kol)
else:
	kol = 1
print(sk * gost * kol - vid)


t = list(map(int, input().split(' ')))
n = t[0]
k = t[1]
a = list(map(int, input().split(' ')))
t = set(a)
t = list(t)
m = 1
for i in range(len(t)):
	if a.count(t[i]) > k:
		temp = a.count(t[i]) // k
		if temp * k != a.count(t[i]):
			temp = temp + 1
		if temp > m:
			m = temp
print(m * k * len(t) - n)


(n, m) = map(int, input().split())
c = [0] * 200
a = list(map(int, input().split()))
for i in range(n):
	c[a[i]] += 1
summ = 0
x = max(c) - max(c) % m
if max(c) % m != 0:
	x += m
for i in range(len(c)):
	if c[i] != 0:
		summ += x - c[i]
print(summ)


import sys
import math
import bisect

def solve(A, m):
	d = dict()
	for a in A:
		if a not in d:
			d[a] = 0
		d[a] += 1
	dish = 0
	for k in d:
		tmp = (d[k] + m - 1) // m * m
		dish = max(dish, tmp)
	ans = 0
	for k in d:
		ans += dish - d[k]
	return ans

def main():
	(n, m) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = solve(A, m)
	print(ans)
main()


utensils = []
(index, sum, N) = (0, 0, 2)
(n, k) = input().split()
n = int(n)
k = int(k)
utensils = input().split()
utensils = [int(i) for i in utensils]
utensils.sort()
while index < len(utensils):
	num = utensils.count(utensils[index])
	index = utensils.count(utensils[index]) + index
	sum = k - num + sum
	if k - num < 0:
		k = k * N / (N - 1)
		N = N + 1
		index = 0
		sum = 0
		continue
	sum = int(sum)
print(sum)


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
l.sort()
d = l.copy()
meals_count = {}
for i in range(1, 101):
	if i in d:
		meals_count[i] = d.count(i)
		d = d[d.count(i):]
max_left = max(meals_count.values())
min_meals = max_left // k + 1 if max_left % k != 0 else max_left // k
min_cutlery = min_meals * len(set(l)) * k
stolen = min_cutlery - n
print(stolen)


import math
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
Need = [0 for i in range(101)]
for i in range(n):
	Need[A[i]] += 1
dishes = math.ceil(max(Need) / k)
different = 0
for elem in Need:
	if elem != 0:
		different += 1
print(dishes * different * k - n)


k = int(input().split(' ')[1])
a = [int(x) for x in input().split(' ')]
a.sort()
dubs = [1]
prev = a[0]
for i in range(1, len(a)):
	if prev != a[i]:
		dubs.append(0)
	dubs[len(dubs) - 1] += 1
	prev = a[i]
a = list(set(a))
dubs_max = max(dubs)
eat = (dubs_max + k - 1) // k * k
a = [eat - x for x in dubs]
print(sum(a))


(n, k) = [int(x) for x in input().split()]
a = [0] * 101
for x in input().split():
	a[int(x)] += 1
m = max(a)
q = 0
for i in range(len(a)):
	if a[i] != 0:
		q += 1
s = (m + k - 1) // k * k
vse = q * s
print(vse - n)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = [0] * 101
for i in range(n):
	s[a[i]] += 1
ans = 0
m = k * math.ceil(max(s) / k)
for i in range(101):
	if s[i] != 0:
		ans += m - s[i]
print(ans)


import math

def KitchenUtensils(numberOfRemainingUten, numberOfGuest):
	index = [0] * 1000
	setOfUten = set()
	typesOfUten = [int(y) for y in input().split()]
	for x in typesOfUten:
		setOfUten.add(int(x))
		index[int(x)] = index[int(x)] + 1
	maximumDishesPossible = math.ceil(max(index) / numberOfGuest)
	numberOfUtenPerDish = len(setOfUten)
	totalNumberOfUten = maximumDishesPossible * numberOfUtenPerDish * numberOfGuest
	stolenUten = totalNumberOfUten - numberOfRemainingUten
	return stolenUten
values = [int(x) for x in input().split()]
remainingUten = values[0]
guest = values[1]
stolenUten = KitchenUtensils(remainingUten, guest)
print(stolenUten)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
li = 0
mc = 0
cc = 0
for i in a:
	if i == li:
		cc += 1
	else:
		mc = max(mc, cc)
		li = i
		cc = 1
mc = max(mc, cc)
t = set(a)
print(len(t) * ((mc + k - 1) // k * k) - n)


from collections import Counter
str1 = input()
str2 = input()
(tablewares_num, guests) = [int(v) for v in str1.split()]
tablewares = Counter(str2.split())
foods = divmod(max(tablewares.values()), guests)
food_count = foods[0] if not foods[1] else foods[0] + 1
print(len(tablewares) * food_count * guests - tablewares_num)


import sys
import math
import itertools
import collections

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
(n, k) = mi()
a = li()
d = collections.Counter(a)
maxd = math.ceil(max(d.values()) / k) * k
ans = 0
for i in d:
	ans += maxd - d[i]
print(ans)


ligne = input().split(' ')
n = int(ligne[0])
k = int(ligne[1])
ligne = input().split(' ')
mat = {}
max = 0
for i in range(n):
	mat[ligne[i]] = 0
for i in range(n):
	mat[ligne[i]] += 1
	if mat[ligne[i]] > max:
		max = mat[ligne[i]]
alls = max / k
if alls - int(alls) > 0:
	alls = int(alls) + 1
else:
	alls = int(alls)
print(alls * k * len(mat) - n)


from math import ceil
(uten, g) = map(int, input().split())
arr = list(map(int, input().split()))
d = ceil(max(map(lambda a: arr.count(a), set(arr))) / g) * g
c = 0
for i in set(arr):
	c += d - arr.count(i)
print(c)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
stpr = [0] * 101
pr = []
for i in a:
	stpr[i] += 1
	pr.append(i)
stpr = set(stpr)
pr = set(pr)
print(k * len(pr) * ((max(stpr) + k - 1) // k) - n)


(n, k) = map(int, input().split())
A = input().split()[:n]
B = []
s = 0
ma = int(0)
for i in range(101):
	B.append([0] * 2)
	B[i][0] = i
	B[i][1] = 0
for i in range(n):
	A[i] = int(A[i])
	for j in range(1, 101):
		if A[i] == B[j][0]:
			B[j][1] += 1
for i in range(101):
	if B[i][1] > s:
		s = B[i][1]
if s % k == 0:
	ma = s
elif s < k:
	ma = k
else:
	ma = int(s / k) * k + k
s = 0
for i in range(101):
	if B[i][1] > 0:
		s += ma - B[i][1]
print(s)


from collections import Counter
from math import ceil
(n, k) = map(int, input().split())
m = Counter(map(int, input().split()))
aa = m.most_common(1)[0][1]
aa = ceil(aa / k)
print(k * aa * len(m) - n)


import math
(n, k) = map(int, input().split())
_ = list(map(int, input().split()))
a = [0 for i in range(101)]
for i in _:
	a[i] += 1
k1 = math.ceil(max(a) / k) * k
s1 = 0
for i in a:
	if i > 0:
		s1 += k1 - i
print(s1)


def okr(a):
	if a == int(a):
		return int(a)
	else:
		return int(a) + 1
(n, k) = map(int, input().split())
li = map(int, input().split())
num = [0] * 100
coun = [0] * 100
for i in li:
	i -= 1
	coun[i] = 1
	num[i] += 1
nume = sum(coun)
maxx = max(num)
prev = okr(maxx / k) * nume * k
print(prev - n)


after = input().split(' ')
n = int(after[0])
k = int(after[1])
things = input().split(' ')
prib = []
for i in range(101):
	cur = 0
	for j in things:
		if j == str(i):
			cur = cur + 1
	prib.append(cur)
u = max(prib) / k
if u % 1 > 0:
	u = u + 1
print(int(len(set(things)) * (u // 1) * k - len(things)))


from math import ceil
(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
d = {}
for i in set(a):
	d[i] = a.count(i)
m = max(d.values())
dishes = ceil(m / k)
types = len(d)
print(types * dishes * k - n)


from collections import Counter
(n, k) = map(int, input().split())
c = Counter(map(int, input().split()))
min_p = (max(c.values()) + k - 1) // k
max_p = max(c.values())
min_stolen = float('inf')
for t in range(min_p, max_p + 1):
	stolen = 0
	for a in c.values():
		stolen += k * t - a
	min_stolen = min(min_stolen, stolen)
print(min_stolen)


(n, k) = map(int, input().split())
Listin = list(map(int, input().split()))
List = [0] * 101
for i in range(len(Listin)):
	List[Listin[i]] += 1
m = max(List)
bl = m / k
if bl != int(bl):
	bl = bl // 1 + 1
kolpr = 0
for i in range(1, 101):
	if List[i] != 0 and List[i] != '#':
		kolpr += 1
print(int(kolpr * bl * k - n))


from math import ceil
(N, K) = [int(i) for i in input().split()]
(Set, List) = (set(), [int(j) for j in input().split()])
Max = 0
for i in List:
	Set.add(i)
for j in Set:
	if List.count(j) > Max:
		Max = List.count(j)
print(ceil(Max / K) * K * len(Set) - N)


(n, k) = map(int, input().split())
lst = [int(x) for x in input().split()]
lst0 = {}
m = 0
for i in range(len(lst)):
	if lst[i] in lst0:
		lst0[lst[i]] += 1
	else:
		lst0[lst[i]] = 1
	if lst0[lst[i]] > m:
		m = lst0[lst[i]]
m = (m + k - 1) // k
s = 0
for i in lst0.keys():
	s += (lst0[i] + k * m - 1) // (m * k) * m * k - lst0[i]
print(s)


import math

def most_common(lst):
	res = dict(((lst.count(i), i) for i in set(lst)))
	return res[max(res.keys())]
a = []
a1 = []
(n, k) = map(int, input().split())
s = str(input()).split()
for i in range(len(s)):
	a.append(int(s[i]))
c = len(set(a))
a1 = [str(i) for i in a]
x = most_common(a1)
nx = a1.count(x)
print(math.ceil(nx / k) * c * k - n)


from collections import Counter
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
u = len(set(a))
d = Counter()
for i in a:
	d[i] += 1
m = d.most_common(1)[0][1]
b = m // k
if m % k != 0:
	b += 1
print(u * b * k - len(a))


(n, n1) = list(map(int, input().split()))
st = input().split()
sp = [st.count(x) for x in list(set(st))]
s = 0
max = n1 * ((max(sp) - 1) // n1 + 1)
for i in sp:
	s += max - i
print(s)


(n, k) = map(int, input().split())
lst = [int(x) for x in input().split()]
cnt = [0] * 101
for x in lst:
	cnt[x] += 1
ans = 0
maxi = 0
for x in range(1, 101):
	maxi = max(maxi, (cnt[x] + k - 1) // k)
for x in range(1, 101):
	if cnt[x] > 0:
		ans += maxi * k - cnt[x]
print(ans)


(a, b) = map(int, input().split())
line = list(map(int, input().split()))
mx = max(line)
cnt = [0] * 100
cnt_num = 0
for i in line:
	cnt[i - 1] += 1
need = max(cnt)
if need % b != 0:
	need += b - need % b
for i in cnt:
	if i != 0:
		cnt_num += need - i
print(cnt_num)


from collections import Counter
(n, k) = list(map(int, input().split()))
a = tuple(Counter(input().split()).values())
print(len(a) * ((max(a) - 1) // k + 1) * k - sum(a))


import math
(n, k) = map(int, input().split())
p = input().split()
a = set(p)
print(k * len(a) * math.ceil(max([p.count(i) for i in a]) / k) - n)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
h = []
for i in range(n):
	if a[i] not in h:
		h += [a[i]]
t = len(h)
a.sort()
l = 1
p = 1
for i in range(1, n):
	if a[i - 1] == a[i]:
		l += 1
	else:
		p = max(p, l)
		l = 1
p = max(p, l)
if p % k == 0:
	print(k * t * (p // k) - n)
else:
	print(k * t * (p // k + 1) - n)


from math import ceil
(n, d) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
b = []
k = 0
c = []
for i in range(max(a)):
	b.append(0)
for i in range(n):
	b[a[i] - 1] += 1
for i in range(len(b)):
	if b[i] > 0:
		c.append(b[i])
k = len(c) * d * ceil(max(c) / d)
ans = k - sum(c)
print(ans)


(number, guest) = map(int, input().split())
a = list(map(int, input().split()))
b = set(a)
c = {i: a.count(i) for i in b}
m = max(c.values())
print(len(b) * ((m - 1) // guest + 1) * guest - len(a))


from collections import Counter
from math import ceil
inp = input().split(' ')
n = int(inp[0])
k = int(inp[1])
sps = input().split(' ')
q = dict(Counter(sps))
dishes = ceil(max(q.values()) / k)
print(len(q) * dishes * k - n)


from collections import Counter
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
dishes = 1
cc = Counter(l)
vals = list(cc.values())
for i in vals:
	if i / k > dishes:
		if i % k == 0:
			dishes = i // k
		else:
			dishes = i // k + 1
print(dishes * len(set(l)) * k - n)


import sys
(n, k) = tuple(map(int, sys.stdin.readline().split()))
asd = {}
lst = list(map(int, sys.stdin.readline().split()))
for i in lst:
	if i in asd.keys():
		a = asd.get(i)
		a = a + 1
		asd.update({i: a})
	else:
		asd.update({i: 1})
m_val = max(asd.values())
leng = len(asd)
if m_val > k:
	if m_val % k == 0:
		blud = m_val // k
	else:
		blud = m_val // k + 1
else:
	blud = 1
sys.stdout.write(str(blud * k * leng - n) + '\n')


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
mx = a.count(max(set(a), key=a.count))
p = ceil(mx / k)
c = p * k * len(set(a))
print(c - n)


(n, k) = input().split(' ')
pos = input().split(' ')
dishes = 0
count = 0
count_h = 0
count_help = []
n = int(n)
k = int(k)
for x in pos:
	if x not in count_help:
		count_help += [x]
		count += 1
for y in count_help:
	if pos.count(y) > count_h:
		count_h = pos.count(y)
dishes = (count_h + k - 1) // k
print(count * dishes * k - n)


from math import ceil
(n, k) = map(int, input().split())
arr = list(map(int, list(input().split())))
d = {}
max_cnt = 0
for i in range(len(arr)):
	x = arr[i]
	if not x in d:
		d[x] = 0
	d[x] += 1
	max_cnt = max(max_cnt, d[x])
min_blud = ceil(max_cnt / k)
print(min_blud * len(d) * k - n)


(n, k) = map(int, input().split())
ost = list(map(int, input().split()))
uch = [0] * 101
for i in ost:
	uch[i] += 1
uch.sort()
ans = 0
check = (uch[-1] + k - 1) // k * k
i = 100
while uch[i]:
	ans += check - uch[i]
	i -= 1
print(ans)


import math
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
sa = set(a)
lsa = len(sa)
csa = [a.count(x) for x in sa]
mcsa = max(csa)
print(int(math.ceil(mcsa / k) * lsa * k - n))


import collections
(n, k) = input().split()
(n, k) = (int(n), int(k))
l = input().split()
c = collections.Counter()
for word in l:
	c[word] += 1
most = c.most_common(1)
a = most[0][1]
b = a // k
if a % k != 0:
	b += 1
b = b * len(list(c)) * k
print(b - n)


import sys
import math

def scan(input_type='int'):
	return list(map(int, sys.stdin.readline().strip().split()))

def solution():
	(n, k) = scan()
	a = scan()
	b = list(set(a))
	c = {}
	for i in a:
		if i in c:
			c[i] += 1
		else:
			c[i] = 1
	m = None
	for i in c:
		if m is None or m > c[i]:
			m = c[i]
	s = 0
	for i in c:
		s = max(s, math.ceil(c[i] / k))
	b = 0
	s *= k
	for i in c:
		b += s - c[i]
	print(b)
solution()


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
aCnt = [0 for i in range(0, 101)]
for i in a:
	aCnt[i] += 1
mx = max(aCnt)
while mx % k != 0:
	mx += 1
u = 0
for i in range(1, 101):
	if aCnt[i] != 0:
		while aCnt[i] % k != 0 or aCnt[i] < mx:
			aCnt[i] += 1
			u += 1
print(u)


x = input()
y = input()
x1 = x.split()
y1 = y.split()
x2 = [int(d) for d in x1]
y2 = [int(d) for d in y1]
y2.sort()
unique = []
counts = []
for num in y2:
	if num not in unique:
		unique.append(num)
for num in unique:
	counts.append(y2.count(num))
if max(counts) % int(x1[1]) != 0:
	num_of_pieces_per_set = max(counts) // int(x1[1]) + 1
else:
	num_of_pieces_per_set = max(counts) // int(x1[1])
print(len(unique) * num_of_pieces_per_set * int(x1[1]) - int(x1[0]))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
xy = list(set(a))
c = len(list(set(a)))
i = 0
de = []
ans = 0
while i != c:
	defy = a.count(xy[i])
	de.append(defy)
	i += 1
if n // k == 0 and n // c == 0:
	print('0')
elif max(de) > k:
	bb = max(de) // k
	if bb >= 1:
		dd = max(de) // k
		if max(de) / k % 1 != 0:
			dd += 1
		else:
			dd = dd
	print(dd * k * c - n)
elif max(de) <= k:
	print(c * k - n)


from math import ceil
(n, k) = map(int, input().split())
kn = {}
l = list(map(int, input().split()))
mx = 0
for i in range(n):
	kn[l[i]] = kn.get(l[i], 0) + 1
	if kn[l[i]] > mx:
		mx = kn[l[i]]
pr = ceil(mx / k) * k
stole = 0
for i in kn.keys():
	stole += max(0, pr - kn[i])
print(stole)


import math
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
maxq = 0
b = {}
for i in set(a):
	b[i] = a.count(i)
maxq = max(b.values())
w = math.ceil(maxq / m)
print(w * len(b) * m - n)


def left_is_not(fet, tip):
	s = 0
	fet += 1
	if tip == 0:
		fet = tip + 10
	return tip
l = list(input().split())
(n, k) = (int(l[0]), int(l[1]))
l2 = list(map(int, input().split()))
l3 = []
p = 0
for i in l2:
	if not i in l3:
		p = p + 1
		l3.append(i)
l4 = [0] * len(l3)
for i in range(len(l3)):
	for j in l2:
		if l3[i] == j:
			l4[i] += 1
w = max(l4)
if w % k == 0:
	p = w // k
else:
	p = w // k + 1
f = len(l3)
print(p * k * f - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = dict()
dif = 0
for elem in a:
	if elem in s:
		s[elem] += 1
	else:
		s[elem] = 1
b = (max(s.values()) + k - 1) // k
print(b * len(s) * k - n)


import math
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
l = set(a)
d = [a.count(i) for i in l]
print(math.ceil(max(d) / k) * len(l) * k - n)


import math
(n, m) = map(int, input().split())
d = {}
mas = list(map(int, input().split()))
for i in range(n):
	if not mas[i] in d:
		d[mas[i]] = 1
	else:
		d[mas[i]] += 1
maxi = 0
for key in d:
	if d[key] > maxi:
		maxi = d[key]
dish = math.ceil(maxi / m)
hide = dish * m
answer = 0
for key in d:
	if d[key] < hide:
		answer += hide - d[key]
print(answer)


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for x in a:
	d[x] = d.get(x, 0) + 1
ans = math.ceil(max(d.values()) / k) * k * len(d) - n
print(ans)


n = input().split(' ')
x = int(n[0])
y = int(n[1])
m = input().split(' ')
nn = []
for i in range(101):
	mm = 0
	for j in m:
		if j == str(i):
			mm = mm + 1
	nn.append(mm)
u = max(nn) / y
if u % 1 > 0:
	u = u + 1
print(int(len(set(m)) * (u // 1) * y - len(m)))


from math import ceil
(n, m) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
c = []
cnt = 0
for o in a:
	if o not in c:
		c.append(o)
d = []
for i in c:
	d.append(a.count(i))
(dishes, set) = (ceil(max(d) / m), len(c))
eta = dishes * set * m
print(eta - n)


from math import ceil
(n, k) = map(int, input().split())
p = [int(x) for x in input().split()]
h = list(set(p.copy()))
i = []
b = 1
for elem in h:
	i.append(p.count(elem))
if max(i) > k:
	b = ceil(max(i) / k)
col = k * b * len(h)
print(col - n)


(n, k) = map(int, input().split())
sp = list(map(int, input().split()))
d = {}
l2 = []
m = 0
for elem in sp:
	if elem in d:
		d[elem] += 1
	else:
		d[elem] = 1
for e in d:
	if d[e] > m:
		m = d[e]
blud_podano = (m - 1) // k + 1
print(blud_podano * len(d) * k - n)


(n, k) = map(int, input().split())
cnts = [1]
g = [int(k) for k in input().split()]
g.sort()
for i in range(1, n):
	if g[i] == g[i - 1]:
		cnts[-1] += 1
	else:
		cnts.append(1)
print((max(cnts) + k - 1) // k * len(cnts) * k - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * max(a)
summa = 0
for i in range(len(a)):
	b[a[i] - 1] += 1
bludo = max(b) // k
if max(b) % k > 0:
	bludo += 1
k = bludo * k
for i in range(len(b)):
	if b[i] > 0:
		summa += k - b[i]
print(summa)


s = input().split()
(n, k) = (int(s[0]), int(s[1]))
a = input().split()
a = list(map(int, a))
d = {}
stolen = 0
for u in a:
	if u in d:
		d[u] += 1
	else:
		d[u] = 1
while sum(list(d.values())) != 0:
	for key in d:
		if k - d[key] >= 0:
			stolen += k - d[key]
			d[key] = 0
		else:
			d[key] -= k
print(stolen)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = dict()
for j in a:
	if d.get(j):
		d[j] += 1
	else:
		d.update({j: 1})
for j in a:
	while d.get(j) % k != 0:
		d[j] += 1
max = 0
for j in a:
	if d.get(j) > max:
		max = d.get(j)
print(max * len(d) - n)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
mp = {}
for i in a:
	mp[i] = a.count(i)
diff = len(list(mp.keys()))
m = max(list(mp.values()))
if m % k == 0:
	m = m // k
else:
	m = m // k + 1
missing = m * diff * k - n
print(missing)


(n, m) = map(int, input().split())
ar = [0] * 100
arr = list(map(int, input().split()))
for i in arr:
	ar[i - 1] += 1
ma = max(ar)
k = 0
for i in ar:
	if i > 0:
		k += 1
x = ma // m
if ma % m != 0:
	x += 1
print(x * k * m - n)


from math import *
(n, k) = (int(s) for s in input().split())
a = [int(s) for s in input().split()]
b = []
for i in range(101):
	if a.count(i) != 0:
		b.append(a.count(i))
l = ceil(max(b) / k)
pm = len(b) * l * k
print(pm - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
mn = 0
b = [0] * 101
r = 0
for i in range(0, len(a)):
	if b[a[i]] == 0:
		mn += 1
	b[a[i]] += 1
for i in range(0, 101):
	r = max((b[i] + k - 1) // k, r)
if k == 1:
	print(mn * r * k - n)
else:
	print(mn * r * k - n)


import math
d = dict()
(n, k) = map(int, input().split())
mass = list(map(int, input().split()))
for i in mass:
	if str(i) in d:
		d[str(i)] += 1
	else:
		d[str(i)] = 1
max_el = max(list(d.values()))
qun = math.ceil(max_el / k)
o_qun = qun * k * len(d)
print(o_qun - n)


from collections import Counter
from math import ceil
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
yy = ceil(Counter(arr).most_common(1)[0][1] / m) * m
c = Counter(arr)
res = 0
for i in c.keys():
	res += yy - c[i]
print(res)


import math
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
x = set(arr)
t = len(x)
cnt = 0
for i in x:
	if arr.count(i) > cnt:
		cnt = arr.count(i)
res = math.ceil(cnt / k)
res2 = res * k * t
stolen = res2 - n
print(stolen)


guestCount = int(input().split()[1])
pribor = [int(x) for x in input().split()]
priborNew = {}
for i in pribor:
	if i in priborNew:
		priborNew[i] += 1
	else:
		priborNew[i] = 1
bludCount = 1
for (id, cnt) in priborNew.items():
	bludCount = max(bludCount, cnt // guestCount + int(cnt % guestCount > 0))
print(bludCount * guestCount * len(priborNew) - len(pribor))


(n, c) = list(map(int, input().split()))
a = list(map(int, input().split()))
s = set(a)
k = []
for i in s:
	k.append(a.count(i))
if max(k) % c == 0:
	d = max(k) // c
	d *= c
else:
	d = max(k) // c + 1
	d *= c
result = 0
for i in k:
	result += d - i
print(result)


(n, k) = map(int, input().split())
a = input().split()
s = 0
a1 = set(a)
a1 = list(a1)
bl = None
for i in range(len(a1)):
	if a.count(a1[i]) > s:
		s = a.count(a1[i])
if s > k:
	while s % k != 0:
		s += 1
	bl = s // k
elif s <= k:
	bl = 1
pri = len(a1)
print(bl * pri * k - n)


R = lambda : [*map(int, input().split())]
(n, k) = R()
a = R()
d = list(set(a))
bc = 0
for i in range(len(d)):
	if a.count(d[i]) > bc:
		bc = a.count(d[i])
if bc > k:
	meals = bc // k
	if bc % k != 0:
		meals += 1
else:
	meals = 1
differ = len(d)
total = differ * k * meals
stolen = total - n
print(stolen)


(n, k) = list(map(int, input().split()))
m = list(map(int, input().split()))
l = [0] * 101
m.sort()
l[m[0]] = 1
types = 1
for i in range(1, n):
	l[m[i]] += 1
	if m[i] != m[i - 1]:
		types += 1
lm = max(l)
if lm % k > 0:
	d = lm // k + 1
else:
	d = lm // k
print(d * types * k - n)


firstLine = input()
secondLine = input()
countOfSame = 0
firstLine = firstLine.split(' ')
secondLine = secondLine.split(' ')
for i in set(secondLine):
	if secondLine.count(i) > countOfSame:
		countOfSame = secondLine.count(i)
countOfMeals = int(countOfSame / int(firstLine[1]))
if countOfSame % int(firstLine[1]) > 0:
	countOfMeals += 1
countOfAll = countOfMeals * int(firstLine[1]) * len(set(secondLine))
stolen = countOfAll - int(firstLine[0])
print(stolen)


_list = list(map(int, input().split()))
(n, k) = (_list[0], _list[1])
a = list(map(int, input().split()))
numbers = {}
for elem in a:
	try:
		numbers[elem] += 1
	except KeyError:
		numbers[elem] = 1
maxim = max(numbers.values())
if maxim == k:
	pass
elif maxim > k:
	multiplier = 2
	while maxim > k * multiplier:
		multiplier += 1
	maxim = k * multiplier
elif maxim < k:
	maxim = k
stolen = 0
for elem in numbers.values():
	stolen += maxim - elem
print(stolen)


from collections import Counter
import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
aa = Counter(a)
maxelem = max(aa, key=aa.get)
maxval = aa[maxelem]
countelem = len(aa)
bludacount = math.ceil(maxval / k)
print(bludacount * k * countelem - n)


import collections
from math import ceil
(n, k) = map(int, input().split())
d = collections.Counter()
for i in input().split():
	d[i] += 1
top = d.most_common(1)[0][1]
count = k * ceil(top / k)
summ = 0
for key in d.keys():
	summ += count - d[key]
print(summ)


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
d = {}
for x in a:
	if x in d:
		d[x] += 1
	else:
		d[x] = 1
mnk = 0
k1 = len(d)
c = []
for key in d:
	c.append(d[key])
	mnk = max(mnk, (d[key] + k - 1) // k)
print(max(0, mnk * len(d) * k - len(a)))


b = list(input().split())
n = int(b[0])
k = int(b[1])
a = list(input().split())
a.sort()
m = int(-1)
ss = int()
x = int(1)
x1 = int()
for i in range(len(a)):
	if a.count(a[i]) > k:
		x1 = int(a.count(a[i]) // k)
		if a.count(a[i]) % k > 0:
			x1 = x1 + 1
	if x1 > x:
		x = x1
for i in range(len(a)):
	if a[i] != m:
		ss = ss + (k * x - a.count(a[i]))
		m = a[i]
print(ss)


(a, b) = map(int, input().split())
aest = list(map(int, input().split()))
best = set(aest)
maxim = 0
for i in best:
	if maxim < aest.count(i):
		maxim = aest.count(i)
colvo = (maxim + b - 1) // b
print(len(best) * colvo * b - a)


(n, k) = (int(i) for i in input().split())
a = (int(i) for i in input().split())
prbs = {}
for prb in a:
	if prb not in prbs:
		prbs[prb] = 0
	prbs[prb] += 1
mx = max(prbs.values())
blud_cnt = mx // k + (mx % k != 0)
print(blud_cnt * k * len(prbs.keys()) - n)


(n, k) = map(int, input().split())
given = list(map(int, input().split()))
a = [0] * 101
pr = 0
ma = 0
for i in given:
	if a[i] == 0:
		pr += 1
	a[i] += 1
	ma = max(ma, a[i])
if ma % k == 0:
	k_for = ma
else:
	k_for = (ma // k + 1) * k
print(k_for * pr - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = set(a)
d = {}
for i in s:
	d[i] = a.count(i)
m = 0
for i in d:
	if d[i] > m:
		m = d[i]
g = m // k
if m % k > 0:
	g += 1
o = g * k * len(s) - n
print(o)


import math
(n, k) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
u_counts = {}
m = 0
for u in a:
	if u in u_counts.keys():
		u_counts[u] += 1
	else:
		u_counts[u] = 1
	m = max(m, u_counts[u])
ans = len(u_counts) * k * math.ceil(m / k) - n
print(ans)


import math
from collections import Counter
(num_utensils, num_guests) = [int(x) for x in input().split()]
utensils = [int(x) for x in input().split()]
utensil_counts = Counter(utensils)
num_dishes_per_guest = math.ceil(max(utensil_counts.values()) / num_guests)
total_utensils = len(utensil_counts) * num_dishes_per_guest * num_guests
print(total_utensils - num_utensils)


a = input().split()
n = int(a[0])
k = int(a[1])
kt = k
c = input().split()
qq = set(c)
maxx = 0
for u in qq:
	if maxx < c.count(u):
		maxx = c.count(u)
while kt < maxx:
	kt += k
summ = len(list(qq)) * kt
print(summ - n)


(n, k) = map(int, input().split())
sp = [int(i) for i in input().split()]
sp.sort()
sp_r = []
sp_v = []
for i in sp:
	if i not in sp_r:
		sp_r.append(i)
		sp_v.append(sp.count(i))
max = max(sp_v)
if max % k != 0:
	max -= max % k
	max += k
min_n = max * len(sp_r)
print(min_n - n)


c = []
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = set(a)
for i in range(0, len(b)):
	c.append(a.count(list(b)[i]))
mn = len(b)
mx = max(c)
while mx % k != 0:
	mx += 1
mx //= k
s = k * mn * mx - n
print(s)


from math import *
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
predmets = dict()
cnt = 0
for i in range(len(a)):
	if a[i] in predmets:
		predmets[a[i]] += 1
	else:
		predmets[a[i]] = 1
		cnt += 1
mx = -1
for i in predmets:
	if predmets[i] > mx:
		mx = predmets[i]
nabors = ceil(mx / k)
print(cnt * nabors * k - len(a))


(n, k) = map(int, input().split())
m = []
m = input().split()
s = []
for i in range(101):
	s.append(0)
for i in range(len(m)):
	s[int(m[i])] += 1
c = 0
M = 0
for i in range(101):
	if s[i] > 0:
		c += 1
	if s[i] > M:
		M = int(s[i])
q = M // k
if M % k != 0:
	q += 1
print(c * k * q - n)


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
m = 0
for i in list(set(li)):
	if li.count(i) > m:
		m = li.count(i)
dishes = 0
if m % k == 0:
	dishes = m
else:
	s = (m + k - 1) // k
	dishes = k * s
print(dishes * len(set(li)) - n)


from math import *
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
c = []
for elem in a:
	if b.count(elem) == 0:
		b.append(elem)
		c.append(a.count(elem))
maxNum = 1
for i in range(len(b)):
	if ceil(c[i] / k) > maxNum:
		maxNum = ceil(c[i] / k)
print(maxNum * len(b) * k - n)


first = [int(num) for num in input().split()]
sec = input().split()
sec_2 = set(sec)
kol = []
for i in sec_2:
	kol.append(sec.count(i))
if max(kol) > first[1]:
	mn = [max(kol) // first[1] + 1, max(kol) // first[1]][max(kol) % first[1] == 0]
	print(len(sec_2) * mn * first[1] - first[0])
else:
	print(first[1] * len(sec_2) - first[0])


from collections import Counter
(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
l = []
m = 0
for i in set(a):
	z = a.count(i)
	if z > m:
		m = z
if m % k != 0:
	r = m // k + 1
else:
	r = m // k
c = len(set(a)) * k * r
print(c - n)


l1 = [int(x) for x in input().split()]
(n, k) = (l1[0], l1[1])
l2 = [int(x) for x in input().split()]
s2 = set(l2)
table = []
for x in s2:
	table.append(l2.count(x))
target = max(table) + int(max(table) % k != 0) * (k - max(table) % k)
print(sum([target - x for x in table]))


s = input()
numbers = list(map(int, s.split()))
n = numbers[0]
k = numbers[1]
s = input()
a = list(map(int, s.split()))
myset = set(a)
cn = len(myset)
count = {}
for num in a:
	count[num] = count.get(num, 0) + 1
mx = max(count.values())
print(int((mx + k - 1) / k) * cn * k - n)


from collections import Counter
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
print((Counter(A).most_common(1)[0][1] + k - 1) // k * len(set(A)) * k - n)


from collections import Counter
(N, K) = map(int, input().split())
aN = list(map(int, input().split()))
counter = Counter(aN)
counter = counter.most_common()
max_utensils = counter[0][1]
dishes = -(-max_utensils // K)
exp_utensils = dishes * len(list(set(aN)))
print(exp_utensils * K - N)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * 101
for i in a:
	b[i] += 1
c = [(i + k - 1) // k * k for i in b]
mx = max(c)
ans = 0
for i in b:
	if i != 0:
		ans += abs(i - mx)
print(ans)


diag = {}
(n, k) = map(int, input().split())
d = list(map(int, input().split()))
for i in d:
	if i in diag:
		diag[i] += 1
	else:
		diag[i] = 1
a = list(diag.values())
Max = 0
for i in a:
	Max = max(Max, i)
Max = ((Max - 1) // k + 1) * k
S = 0
for i in a:
	S += Max - i
print(S)


(n, k) = [int(x) for x in input().split()]
types = input().split()
uTypes = set(types)
t = len(uTypes)
s = 1
for x in uTypes:
	while types.count(x) > s * k:
		s += 1
print(s * t * k - n)


import math
(n, k) = list(map(int, input().split()))
things = list(map(int, input().split()))
set = []
amountOfEachThing = []
for i in things:
	if i not in set:
		set.append(i)
for j in range(len(set)):
	amountOfEachThing.append(things.count(set[j]))
amountOfPlates = math.ceil(max(amountOfEachThing) / k)
maxAmountOfThings = k * amountOfPlates * len(set)
print(maxAmountOfThings - n)


import math

class CodeforcesTask1032ASolution:

	def __init__(self):
		self.result = ''
		self.n_k = []
		self.utens = []

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]
		self.utens = [int(x) for x in input().split(' ')]

	def process_task(self):
		cnts = [self.utens.count(x) for x in list(set(self.utens))]
		all = len(set(self.utens)) * math.ceil(max(cnts) / self.n_k[1]) * self.n_k[1]
		missing = all - sum(cnts)
		self.result = str(missing)

	def get_result(self):
		return self.result
Solution = CodeforcesTask1032ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
d = {}
for w in a:
	if w in d.keys():
		d[w] += 1
	else:
		d[w] = 1
p = k * ((max(d.values()) + k - 1) // k)
s = 0
for w in d.values():
	s += p - w
print(s)


(n, k) = list(map(int, input().split()))
ar = list(map(int, input().split()))
ar.sort()
i = 0
b = [0 for i in range(101)]
for i in ar:
	b[i] += 1
nab = max(b) // k
if max(b) % k > 0:
	nab += 1
ras = 0
for i in b:
	if i > 0:
		ras += 1
print(nab * k * ras - n)


(n, k) = list(map(int, input().split()))
sets = list(map(int, input().split()))
dish = sorted(set(sets))
d = []
c_d = 0
ans = 0
for i in dish:
	d.append(sets.count(i))
c_d = max(d)
if c_d % k != 0:
	c_d = (c_d // k + 1) * k
for i in d:
	ans += c_d - i
print(ans)


from collections import Counter
from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for el in a:
	d[el] = d.get(el, 0) + 1
n_food = ceil(max(d.values()) / k)
ans = len(d) * n_food * k - len(a)
print(ans)


l = list(map(int, input().split()))
n = l[0]
k = l[1]
cultery = list(map(int, input().split()))
cultery.sort()
m = 1
s = 1
types = 1
for i in range(1, len(cultery)):
	if cultery[i] == cultery[i - 1]:
		s += 1
	else:
		if s > m:
			m = s
		s = 1
		types += 1
if s > m:
	m = s
for_one = (m - 1) // k + 1
s = 0
st = for_one * types * k - n
print(st)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
nabor = list(set(a))
kol = {}
maxi = 0
for i in a:
	if i in kol:
		kol[i] += 1
		if kol[i] > maxi:
			maxi = kol[i]
	else:
		kol[i] = 1
		if kol[i] > maxi:
			maxi = kol[i]
if maxi % k == 0:
	ito = maxi
else:
	ito = (maxi // k + 1) * k
print(ito * len(nabor) - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
count = 1
a.sort()
r = len(set(a))
max = 0
res = a[0]
for i in a:
	freq = a.count(i)
	if freq > max:
		max = freq
		res = i
if k < max:
	x = max // k
	if max % k == 0:
		print(x * k * r - n)
	else:
		print((x + 1) * k * r - n)
else:
	print(k * r - n)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
import heapq
from collections import Counter
from bisect import bisect_right
import bisect
import math
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
c = Counter(arr)
ans = math.ceil(max(c.values()) / k)
ans *= k * len(c.values())
print(ans - n)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
d = {}
for i in input().split(' '):
	a = int(i)
	if a in d.keys():
		d[a] += 1
	else:
		d[a] = 1
num = k
for i in d.values():
	if i > num:
		if i % k:
			num = k * (i // k + 1)
		else:
			num = i
print(num * len(d) - n)


import math
(n, k) = [int(i) for i in input().strip().split(' ')]
a = [int(i) for i in input().strip().split(' ')]
u_set = {}
max_cnt = 0
for i in a:
	u_set[i] = i
	cnt = a.count(i)
	if cnt > max_cnt:
		max_cnt = cnt
s_u = len(u_set)
d = math.ceil(max_cnt / k)
print(k * d * s_u - n)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
a = [0] * 101
cnt = 0
for i in lst:
	a[i] += 1
	if a[i] == 1:
		cnt += 1
x = max(a)
if x % k == 0:
	p = x // k
else:
	p = x // k + 1
print(cnt * p * k - n)


(n, k) = map(int, input().split())
lefts = map(int, input().split())
ut = {}
umax = 0
for t in lefts:
	if not t in ut:
		ut[t] = 0
	ut[t] += 1
	if ut[t] > umax:
		umax = ut[t]
utypes = len(ut)
nt = umax // k
if umax % k != 0:
	nt += 1
disnum = nt * k
print(disnum * utypes - n)


from math import *
(n, k) = map(int, input().split())
sl = list(map(int, input().split()))
x = 0
xxl = []
for i in range(len(sl)):
	if sl[i] not in xxl:
		if sl.count(sl[i]) > x:
			x = sl.count(sl[i])
		xxl.append(sl[i])
xl = ceil(x / k)
ans = k * xl * len(xxl) - len(sl)
print(ans)


I = lambda : map(int, input().split())
(n, k) = I()
a = (*I(),)
m = len({*a})
x = 0 - -max((a.count(x) for x in {*a})) // k
print(m * x * k - n)


(n, m) = map(int, input().split())
listik = list(map(int, input().split()))
maximum = 0
for i in listik:
	if listik.count(i) > maximum:
		maximum = listik.count(i)
if maximum % m == 0:
	number = maximum // m
else:
	number = maximum // m + 1
print(len(set(listik)) * number * m - len(listik))


import math
(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a = sorted(a)
(i, s, max, p) = (0, 0, 0, 0)
while i < n - 1:
	if a[i] == a[i + 1]:
		s += 1
		if s > max:
			max = s
	else:
		s = 0
		p += 1
	i += 1
print((p + 1) * math.ceil((max + 1) / k) * k - n)


import math
(a, b) = list(map(int, input().split()))
c = list(map(int, input().split()))
d = dict()
max = 0
for k in c:
	if k in d:
		d[k] += 1
		if d[k] > max:
			max = d[k]
	else:
		d[k] = 1
		if max == 0:
			max = 1
cnt = math.ceil(max / b)
cnt = cnt * b
res = 0
for k in d:
	res += cnt - d[k]
print(res)


(n, k) = map(int, input().split())
mass = [0] * 101
a = list(map(int, input().split()))
s = 0
for i in a:
	mass[i] += 1
	s += 1
count = ((max(mass) - 1) // k + 1) * k
empty = 0
for i in mass:
	if i == 0:
		empty += 1
print((len(mass) - empty) * count - s)


import sys, math

def mp():
	return list(map(int, input().split()))

def f(n, k, a, c):
	m = 0
	t = 0
	for i in c:
		m = max(m, (i - 1) // k + 1)
		if i:
			t += 1
	cnt = m * k * t
	return max(cnt - n, 0)

def main():
	(n, k) = mp()
	a = mp()
	c = [0] * 101
	for i in a:
		c[i] += 1
	print(f(n, k, a, c))
debug = 0
if debug:
	file = open('input.txt', 'r')
	input = file.readline
main()
if debug:
	file.close()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
preb = []
count = []
for i in range(n):
	temp = a[i]
	if preb.count(temp) != 0:
		count[preb.index(temp)] += 1
	else:
		count.append(1)
		preb.append(temp)
M = max(count)
if M % k == 0:
	x = M // k
else:
	x = M // k + 1
print(x * len(preb) * k - n)


(n, k) = [int(x) for x in input().split()]
ar = [int(x) for x in input().split()]
counts = [ar.count(i) for i in range(1, 101)]
dishes = (max(counts) + (k if max(counts) % k != 0 else 0)) // k
uni = set(ar)
print(len(uni) * dishes * k - n)


(n, k) = [int(i) for i in input().split(' ')]
d = {}
for c in map(int, input().split()):
	if c in d:
		d[c] += 1
	else:
		d[c] = 1
m = max(d.values())
if m % k > 0:
	m = (m // k + 1) * k
r = 0
for c in d:
	r += m - d[c]
print(r)


(n, k) = map(int, list(input().split()))
ust = list(input().split())
seen = [0] * 101
for i in range(n):
	usti = int(ust[i])
	seen[usti] += 1
nonnull = 0
for j in seen:
	if j != 0:
		nonnull += 1
m = max(seen)
if m % k != 0:
	m = m // k + 1
else:
	m = m // k
print(k * nonnull * m - n)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
D = [0] * 100
for i in range(n):
	D[a[i] - 1] += 1
m = max(D)
l = ((m - 1) // k + 1) * k
ans = 0
for i in range(100):
	if D[i] > 0:
		ans += l - D[i]
print(ans)


(n, k) = list(map(int, input().split()))
loc = list(map(int, input().split()))
a = dict()
for i in range(n):
	if loc[i] in a:
		a[loc[i]] += 1
	else:
		a[loc[i]] = 1
b = list(a.values())
b.sort(reverse=True)
l = len(b)
nab = -(-b[0] // k)
print(nab * k * l - sum(b))


(n, k) = map(int, input().split())
a = [int(el) for el in input().split()]
b = [0] * 101
for i in a:
	b[i] += 1
mm = max(b)
z = mm // k
if mm % k != 0:
	z += 1
z = z * k
s = 0
for i in b:
	if i != 0:
		s += z - i
print(s)


import math
(n, k) = [int(el) for el in input().split()]
a = [int(el) for el in input().split()]
mn = set(a)
mcol = 0
m = 0
for i in mn:
	if mcol < a.count(i):
		mcol = a.count(i)
x = math.ceil(mcol / k)
print(x * k * len(mn) - n)


import math

def min_utensil_token(num_utensil, guest, left_utensil):
	max_num_utensil = 0
	utensil_dic = {}
	for utensil in left_utensil:
		if utensil in utensil_dic:
			utensil_dic[utensil] += 1
			if utensil_dic[utensil] > max_num_utensil:
				max_num_utensil = utensil_dic[utensil]
		else:
			utensil_dic[utensil] = 1
			if utensil_dic[utensil] > max_num_utensil:
				max_num_utensil = utensil_dic[utensil]
	return math.ceil(max_num_utensil / float(guest)) * len(utensil_dic) * int(guest) - int(num_utensil)
(n, k) = input().split()
utensils = input().split()
print(min_utensil_token(n, k, utensils))


(u, p) = map(int, input().split())
lst = list(map(int, input().split()))
d = {}
for c in range(u):
	d[lst[c]] = d.get(lst[c], 0) + 1
k = max(d.values())
if k % p != 0:
	k = (k // p + 1) * p
x = len(d)
print(k * x - u)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
hsh = [0] * 101
mxFreq = 0
types = 0
for i in a:
	hsh[i] += 1
	if hsh[i] == 1:
		types += 1
	mxFreq = max(mxFreq, hsh[i])
mn = mxFreq * types
mult = k * types
x = mult
while x < mn:
	x += mult
print(x - n)


(n, k) = map(int, input().split())
massIn = map(int, input().split())
Pribor = {}
for i in massIn:
	if i in Pribor:
		Pribor[i] += 1
	else:
		Pribor[i] = 1
max = 0
for i in Pribor.values():
	if max < i:
		max = i
kolBlud = 0
if max % k == 0:
	kolBlud = max // k
else:
	kolBlud = max // k + 1
print(kolBlud * k * len(Pribor) - n)