#include <bits/stdc++.h>
using namespace std;
int a[100009], dp[1000009];
const int INF = 1000 * 1000 * 1000 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
    mx = max(mx, a[x]);
  }
  if (mx % k)
    mx = (mx / k + 1) * k;
  else
    mx = (mx / k) * k;
  int ans = 0;
  for (int i = 1; i <= 100; i++) {
    if (a[i]) ans += mx - a[i];
  }
  cout << ans;
  return 0;
}
