#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, max_c = 0;
  vector<int> counts(100);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int q;
    cin >> q;
    ++counts[q - 1];
    max_c = max_c > counts[q - 1] ? max_c : counts[q - 1];
  }
  max_c = ((max_c + (k - 1)) / k) * k;
  int ans = 0;
  for (int i = 0; i < 100; i++) {
    if (counts[i] != 0) ans += max_c - counts[i];
  }
  cout << ans;
  return 0;
}
