#include <bits/stdc++.h>
int main() {
  int n, k, a[101] = {0}, v = 0, c = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
    if (((a[x] + k - 1) / k) > v) v = ((a[x] + k - 1) / k);
  }
  for (int i = 0; i <= 100; i++) {
    if (a[i] != 0) {
      c += v * k - a[i];
    }
  }
  printf("%d", c);
}
