#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, maxs = 0, coun = 0;
  cin >> n >> m;
  vector<int> a(101);
  set<int> b;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (a[x] == 0) coun++;
    a[x]++;
    if (maxs <= a[x]) maxs = a[x];
  }
  if (maxs % m == 0)
    maxs /= m;
  else {
    maxs /= m;
    maxs++;
  }
  cout << maxs * m * coun - n;
}
