#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  int typ[100] = {};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    typ[a[i] - 1]++;
  }
  int max_ = 0;
  int max_type = 0;
  int types = 0;
  for (int i = 0; i < 100; i++) {
    if (typ[i] > 0) types++;
    if (typ[i] > max_) max_ = typ[i];
  }
  cout << types * ((max_ + (k - 1)) / k) * k - n;
}
