#include <bits/stdc++.h>
using namespace std;
ifstream in;
ofstream out;
const long long INF = LLONG_MAX;
long long n;
long long k;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(20);
  srand(time(0));
  cin >> n >> k;
  map<long long, long long> mm;
  long long _max = 0;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    x--;
    mm[x]++;
    if (mm[x] > _max) {
      _max = mm[x];
    }
  }
  long long blud;
  if (_max % k == 0) {
    blud = _max / k;
  } else {
    blud = (_max / k) + 1;
  }
  long long answer = k * mm.size() * blud;
  for (auto i : mm) {
    answer -= i.second;
  }
  cout << answer;
  return 0;
}
