#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
const long double eps = 0.0000000001;
const long long INF = 0x3fffffffffffffff;
long long t[105], n, k, Max, has, tmp;
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) {
    cin >> tmp;
    ++t[tmp];
  }
  for (long long i = 1; i <= 100; ++i) {
    if (t[i]) {
      ++has;
    }
    Max = max(Max, (long long)ceil(t[i] * 1.0 / k) * k);
  }
  cout << has * Max - n << endl;
  return 0;
}
