#include <bits/stdc++.h>
using namespace std;
int n, k, a[200];
int main() {
  cin >> n >> k;
  int x;
  for (register int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    a[x]++;
  }
  int mx = -1, sum = 0;
  for (register int i = 1; i <= 100; ++i) {
    if (a[i]) mx = max(mx, a[i]), sum++;
  }
  if (mx % k == 0)
    mx /= k;
  else
    mx = mx / k + 1;
  int ans = sum * mx * k - n;
  cout << ans;
  return 0;
}
