#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, d;
  cin >> n >> k;
  int used[101];
  for (int i = 0; i < 101; ++i) used[i] = 0;
  for (int i = 0; i < n; ++i) {
    cin >> d;
    used[d] += 1;
  }
  int mx = -1;
  for (int i = 0; i < 101; ++i) {
    if (mx < used[i]) mx = used[i];
  }
  if (mx < k)
    mx = k;
  else {
    for (int i = 0; i < 1000; ++i) {
      if ((mx + i) % k == 0) {
        mx = mx + i;
        break;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 101; ++i) {
    if (used[i] != 0) {
      ans += mx - used[i];
    }
  }
  cout << ans;
}
