#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
const int INF = 2e9 + 179, MOD = 1e9 + 7;
const long long int BIGINF = 2e18 + 179;
const long double EPS = 0.000001;
using namespace std;
int solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  map<int, int> q;
  int kek = 1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (q.find(a[i]) == q.end()) {
      q[a[i]] = 1;
    } else {
      q[a[i]]++;
      kek = max(kek, q[a[i]]);
    }
  }
  int lol = (kek + k - 1) / k;
  cout << lol * (long long int)q.size() * k - n << "\n";
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}
