#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  map<int, int> mp;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
    mx = max(mx, mp[a[i]]);
  }
  int ans = (ceil((double)mx / (double)k) * k * mp.size()) - n;
  cout << ans;
}
