#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, k = 0;
  cin >> n >> k;
  int arr[n];
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    m[arr[i]]++;
  }
  map<int, int>::iterator itr;
  int max_count = 0;
  for (itr = m.begin(); itr != m.end(); itr++) {
    if (itr->second > max_count) max_count = itr->second;
  }
  cout << (k * ceil((double)max_count / (double)k) * m.size()) - n;
}
