#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a1;
  cin >> n >> k;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> a1;
    a.push_back(a1);
  }
  map<int, int> m;
  for (auto j : a) {
    m[j]++;
  }
  sort(a.begin(), a.end());
  vector<int>::iterator it = unique(a.begin(), a.end());
  a.resize(distance(a.begin(), it));
  vector<int> c;
  for (int l = 0; l < a.size(); l++) {
    c.push_back(m[a[l]]);
  }
  int max = *max_element(c.begin(), c.end());
  int sum = accumulate(c.begin(), c.end(), 0);
  int rem = max % k;
  int result;
  if (rem == 0) {
    result = max * a.size();
    cout << result - sum << endl;
  } else {
    int res = k - rem + max;
    result = res * a.size();
    cout << result - sum << endl;
  }
}
