#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> arr(100);
  int cnt = 0, mx = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    cnt += (arr[x - 1] == 0);
    ++arr[x - 1];
    mx = max(mx, (arr[x - 1] + k - 1) / k);
  }
  cout << mx * cnt * k - n;
  return 0;
}
