#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  map<ll, ll> x;
  ll n, k;
  cin >> n >> k;
  ll tmp;
  for (ll i = 0; i < n; i++) {
    cin >> tmp;
    x[tmp]++;
  }
  ll amount = x.size();
  ll day = 1;
  for (auto& y : x) {
    if (y.second / k != 0) {
      if (y.second % k == 0) {
        if (day < y.second / k) {
          day = y.second / k;
        }
      } else {
        if (day < y.second / k + 1) {
          day = y.second / k + 1;
        }
      }
    }
  }
  cout << (amount * day * k) - n << endl;
}
