#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int c = 0;
  int u = 0;
  for (int i = 0; i < n + 1; i++) {
    c++;
    if (a[i] != a[i + 1]) {
      u = max(u, c);
      c = 0;
    }
  }
  int ans;
  if (u % k == 0) {
    ans = (u / k) * k;
  } else {
    ans = ((u / k) + 1) * k;
  }
  c = 0;
  int ansf = 0;
  for (int i = 0; i < n; i++) {
    c++;
    if (a[i] != a[i + 1]) {
      ansf += ans - c;
      c = 0;
    }
  }
  cout << ansf;
  return 0;
}
