#include <bits/stdc++.h>
using namespace std;
double const pi = 3.1415926536;
int main() {
  set<int> b;
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b.insert(a[i]);
  }
  sort(a.begin(), a.end());
  int c = 1, max = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[i - 1])
      c++;
    else {
      if (c > max) max = c;
      c = 1;
    }
  }
  if (c > max) max = c;
  int z;
  if (max % k == 0)
    z = max / k;
  else
    z = max / k + 1;
  cout << z * b.size() * k - n;
}
