#include <bits/stdc++.h>
using namespace std;
long long a[105];
int main() {
  long long i, j, k, n, m, x = 0, y, z, t, d, aa, bb;
  cin >> n >> k;
  long long a1[n + 5];
  for (i = 0; i < n; i++) {
    cin >> a1[i];
    a[a1[i]]++;
  }
  m = *max_element(a, a + 101);
  y = m / k;
  if (y * k != m) {
    aa = m - (y * k);
    bb = k - aa;
    t = bb + m;
    for (i = 0; i < 101; i++) {
      if (a[i] > 0) {
        j = abs(t - a[i]);
        x = x + j;
      }
    }
    cout << x << endl;
  } else {
    for (i = 0; i < 101; i++) {
      if (a[i] > 0) {
        j = abs(m - a[i]);
        x = x + j;
      }
    }
    cout << x << endl;
  }
}
