#include <bits/stdc++.h>
using namespace std;
int N, K;
int ans;
map<int, int> cnt;
void in() {
  cin >> N >> K;
  int b;
  for (int i = 1; i <= N; i++) {
    cin >> b;
    cnt[b]++;
  }
}
void solution() {
  int maxn = 0;
  map<int, int>::iterator it = cnt.begin();
  for (it = cnt.begin(); it != cnt.end(); it++) {
    maxn = max(it->second, maxn);
  }
  int t;
  if (maxn % K == 0) {
    t = maxn;
  } else {
    if (maxn > K) {
      t = ((maxn / K) + 1) * K;
    } else {
      t = K;
    }
  }
  for (it = cnt.begin(); it != cnt.end(); it++) {
    ans += (t - it->second);
  }
}
void out() { cout << ans; }
int main() {
  in();
  solution();
  out();
  return 0;
}
