#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  int fill[105];
  for (int i = 0; i < 105; i++) {
    fill[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    fill[a[i]]++;
  }
  int cnt = 0, MAX = 0;
  for (int i = 1; i <= 100; i++) {
    if (fill[i] != 0) {
      cnt++;
      if (MAX < fill[i]) {
        MAX = fill[i];
      }
    }
  }
  cout << (((MAX + m - 1) / m) * cnt * m) - n;
}
