#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, t, i, j = 0, mx = 0;
  int* arr = new int[n];
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> t;
    if (arr[t] == 0) j++;
    arr[t]++;
    mx = max(mx, arr[t]);
  }
  cout << (k * j * (mx / k + (mx % k != 0))) - n << endl;
  delete[] arr;
  return 0;
}
