#include <bits/stdc++.h>
using namespace std;
template <typename T>
void vout(T x) {
  cout << x << endl;
  exit(0);
}
int gcd(int a, int b) {
  while (a && b) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
const int inf = 1e9;
const long long INF = 1e18;
int n, k, a[110], b[110], mx = -1e9, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[a[i]]++;
  }
  for (int i = 1; i <= 100; ++i) {
    if (b[i]) mx = max(mx, b[i]);
  }
  while (1) {
    if (mx % k == 0)
      break;
    else
      mx++;
  }
  for (int i = 1; i <= 100; ++i) {
    if (b[i]) ans += mx - b[i];
  }
  cout << ans << endl;
  return 0;
}
