#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
bool is_vowel(char c) {
  c = tolower(c);
  return c == 'a' || c == 'e' || c == 'o' || c == 'i' || c == 'u' || c == 'y';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  map<int, int> dict;
  int ma = 0;
  for (int i = 0, a; i < n; i++) {
    cin >> a;
    dict[a]++;
    if (dict[a] > ma) ma = dict[a];
  }
  if (ma % k > 0) {
    ma = ma + (k - ma % k);
  }
  int res = 0;
  for (auto p : dict) res += ma - p.second;
  cout << res;
  return 0;
}
