#include <bits/stdc++.h>
using namespace std;
int n, k, b[101], mx = 0, s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    b[x]++;
    mx = max(mx, b[x]);
  }
  if (mx % k == 0)
    mx /= k;
  else
    mx = mx / k + 1;
  for (int i = 1; i <= 100; i++) {
    if (b[i] != 0) s += (k * mx) - b[i];
  }
  cout << s;
}
