#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n;
  cin >> k >> n;
  map<int, int> m1;
  for (int i = 0; i < k; i++) {
    int now;
    cin >> now;
    m1[now]++;
  }
  int max = 0;
  for (map<int, int>::iterator i = m1.begin(); i != m1.end(); i++) {
    if (max < (*i).second) {
      max = (*i).second;
    }
  }
  int hum;
  if (max % n == 0) {
    hum = max;
  } else {
    hum = max + (n - max % n);
  }
  int res = 0;
  for (map<int, int>::iterator i = m1.begin(); i != m1.end(); i++) {
    res += hum - (*i).second;
  }
  cout << res;
}
