#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  int k;
  cin >> n >> k;
  int c = 0;
  int otv = 0;
  map<int, int> cnt;
  int* a = new int[n];
  bool vect[1000];
  for (int i = 0; i < 300; ++i) {
    vect[i] = false;
  }
  int maxcnt = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cnt[a[i]]++;
    maxcnt = max(maxcnt, cnt[a[i]]);
  }
  if (maxcnt % k == 0) {
    c = maxcnt;
  } else {
    c = (maxcnt / k + 1) * k;
  }
  for (int i = 0; i < n; ++i) {
    if (!vect[a[i]]) {
      otv += c - cnt[a[i]];
      vect[a[i]] = true;
    }
  }
  cout << otv << endl;
  return 0;
}
