#include <bits/stdc++.h>
using namespace std;
int a[1000], times[1000];
int ceilDiv(int x, int y) {
  int temp = x / y;
  if (temp * y < x) temp++;
  return temp;
}
int main() {
  int greatest = 0;
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    times[a[i]]++;
    if (a[i] > greatest) greatest = a[i];
  }
  int set = 1;
  bool first = true;
  sort(times, times + greatest + 1);
  for (int i = 0; i <= greatest; i++) {
    if (times[i] > k) {
      set = ceilDiv(times[i], k);
    } else if ((first) && (times[i] == k)) {
      set = 1;
      first = false;
    }
  }
  int sum = 0;
  for (int i = 0; i <= greatest; i++) {
    if (times[i] > 0) {
      sum += (k * set) - times[i];
    }
  }
  printf("%d\n", sum);
}
