#include <bits/stdc++.h>
const int MAXINT = 2147483640;
const long long MAXLL = 9223372036854775800LL;
const long long MAXN = 1e6;
const double eps = 1e-9;
const long long mod = 1e9 + 7;
using namespace std;
long long n, k, a[MAXN], f[MAXN];
int main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> k;
  long long da = 0;
  long long mx = 1e18;
  for (int i = 1; i <= n; ++i) {
    long long x;
    cin >> x;
    f[x]++;
    da = max(da, f[x]);
  }
  for (int i = 1; i <= 100; ++i) {
    long long ans = 0, now = i * k;
    if (now >= da) {
      for (int j = 1; j <= 100; ++j)
        if (f[j]) {
          ans += now - f[j];
        }
      mx = min(ans, mx);
    }
  }
  cout << mx << "\n";
  return 0;
}
