#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  map<int, int> d;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    d[k]++;
  }
  vector<int> a;
  int mx = 0;
  for (auto e : d) {
    a.push_back(e.second);
    mx = max(mx, e.second);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int answ = 0;
  int h = (a[0] + k - 1) / k;
  for (int i = 0; i < int(a.size()); i++) answ += max(0, k * h - a[i]);
  cout << answ;
}
