#include <bits/stdc++.h>
using namespace std;
const int p = 997;
const int base = 1e9 + 7;
const int MAXN = 1e8;
const int MAX_W = 301;
const int INF = 1e9 + 30;
const int MOD = 1e9;
const double PII = 3.14159265358979323846264338327950288419716939937510;
const double Epsilon = 1e-6;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long a, b, c, t, cnt = 0, sum = 0, n, k, l, m, maxi = 0;
  cin >> n >> k;
  vector<long long> ff(1000, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a;
    if (ff[a] == 0) {
      ++cnt;
    }
    ff[a]++;
    maxi = max(maxi, ff[a]);
  }
  if (maxi % k == 0) {
    t = maxi;
  } else {
    t = maxi + (k - maxi % k);
  }
  t = t * cnt;
  cout << t - n;
  return 0;
}
