#include <bits/stdc++.h>
using namespace std;
long long n, k, a[100005];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    long long t;
    cin >> t;
    a[t]++;
  }
  long long M = 0;
  for (long long i = 1; i <= 100; i++)
    if (a[i] > 0) M = max(M, ((a[i] - 1) / k + 1) * k);
  long long ans = 0;
  for (long long i = 1; i <= 100; i++)
    if (a[i] > 0) ans += M - a[i];
  cout << ans;
}
