#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, t, max, total, type, table[101];
  while (~scanf("%d %d", &n, &k)) {
    for (int i = 1; i < 101; i++) {
      table[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      scanf("%d", &t);
      table[t]++;
    }
    max = 0;
    type = 0;
    total = 0;
    for (int i = 1; i < 101; i++) {
      total += table[i];
      if (table[i] > 0) {
        type++;
      }
      if (ceil(table[i] / (double)k) > max) {
        max = (int)ceil(table[i] / (double)k);
      }
    }
    printf("%d\n", max * type * k - total);
  }
  return 0;
}
