#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> cnt(100, 0);
  for (int i = 0; i < n; ++i) {
    int val;
    cin >> val;
    --val;
    ++cnt[val];
  }
  int dishes = 0;
  for (int i = 0; i < 100; ++i) {
    dishes = max(dishes, (cnt[i] + k - 1) / k);
  }
  int answer = 0;
  for (int i = 0; i < 100; ++i) {
    if (cnt[i] > 0) {
      answer += dishes * k - cnt[i];
    }
  }
  cout << answer;
  return 0;
}
