#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, temp, m = 0;
  cin >> n >> k;
  set<int> v;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    v.insert(temp);
    mp[temp]++;
    m = max(m, mp[temp]);
  }
  if (m % k) m = (m / k) * k + k;
  int res = 0;
  for (auto x = v.begin(); x != v.end(); x++) res += (m - mp[*x]);
  cout << res << endl;
}
