"""
 *
 * Author:  Juarez Paulino(coderemite)
 * Email: juarez.paulino@gmail.com
 *
 """
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)