#include <bits/stdc++.h>
using namespace std;
const int N = 1e2;
int arr[N];
int main() {
  int n, k, a, sum = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (!arr[a - 1]) {
      sum++;
    }
    arr[a - 1]++;
  }
  a = 0;
  for (int i = 0; i < N; i++) {
    if (arr[i] % k == 0) {
      a = max(a, arr[i] / k);
    } else {
      a = max(a, arr[i] / k + 1);
    }
  }
  cout << sum * a * k - n;
  return 0;
}
