#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[1010], maxx = -1, res[1010], ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (res[a[i]] > 0)
      res[a[i]]++;
    else
      res[a[i]] = 1;
    maxx = max(maxx, res[a[i]]);
  }
  maxx = maxx + ((k - (maxx % k)) % k);
  for (int i = 1; i < 101; i++) {
    if (res[i] > 100 || res[i] < 1) continue;
    ans += (maxx - res[i]);
  }
  cout << ans;
  return 0;
}
