#include <bits/stdc++.h>
using namespace std;
int n, m, countt[10000], tr, maxx, summ;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> tr;
    countt[tr]++;
  }
  for (int i = 1; i <= 100; i++) {
    maxx = max(maxx, countt[i]);
  }
  if (maxx % m != 0) {
    maxx += m - (maxx % m);
  }
  for (int i = 1; i <= 100; i++) {
    if (countt[i] != 0) {
      summ += maxx - countt[i];
    }
  }
  cout << summ;
  return 0;
}
