#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, m, mx = 0;
  cin >> n >> m;
  map<int, int> a;
  for (int i = 0; i < n; i++) {
    int q;
    cin >> q;
    a[q]++;
    if (a[q] > mx) mx = a[q];
  }
  int kolvbl = mx / m + (mx % m != 0), ans = 0;
  for (auto i : a) {
    ans += kolvbl * m - i.second;
  }
  cout << ans;
  return 0;
}
