#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  vector<int> a;
  map<int, int> utensil_counts;
  for (int i = 0; i < n; ++i) {
    int an;
    scanf("%d", &an);
    a.push_back(an);
    ++utensil_counts[an];
  }
  int max_cnt = 0;
  for (const auto& i : utensil_counts) {
    max_cnt = max(max_cnt, i.second);
  }
  int min_dishes = ceil(double(max_cnt) / k);
  int num_utensils = min_dishes * utensil_counts.size() * k;
  printf("%d\n", num_utensils - n);
}
