#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
const long long LINF = 1e18 + 5;
const double eps = 1e-9;
fstream fin, fout;
int main() {
  int n, k;
  cin >> n >> k;
  int m = 0, dif = 0;
  map<int, int> q;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (!q.count(a)) {
      dif++;
      q[a] = 1;
    } else
      q[a]++;
    m = max(m, q[a]);
  }
  int j = m / k;
  if (m % k) j++;
  cout << k * j * dif - n;
}
