#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, j = 0, kind;
  scanf("%d%d", &n, &k);
  int untill[n], sum[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &untill[i]);
    sum[i] = 1;
  }
  sort(untill, untill + n);
  for (i = 0; i < n; i++) {
    if (untill[i] == untill[i + 1])
      sum[j]++;
    else
      j++;
  }
  sort(sum, sum + j);
  if (sum[j - 1] % k == 0)
    kind = sum[j - 1] / k;
  else
    kind = sum[j - 1] / k + 1;
  printf("%d", kind * j * k - n);
  return 0;
}
