#include <bits/stdc++.h>
using namespace std;
const long long int LL_MAX = 1e18 + 5;
const int MX = 1e9;
const long long int mod = 1000000007;
const int maxx = 2e5;
typedef unordered_map<int, int> umapII;
typedef const char *cstr;
void SieveOfEratosthenes(vector<int> &a) {
  bool prime[1005];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p < 1005; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i < 1005; i += p) prime[i] = false;
    }
  }
  for (long long p = 2; p < 1005; p++) {
    if (prime[p]) a[p] = p;
  }
}
const int N = 1e5;
vector<int> gr[N];
int vis[N + 1];
void bfs_tree(int source) {
  queue<int> Q;
  Q.push(source);
  vis[source] = 1;
  while (!Q.empty()) {
    int cur = Q.front();
    Q.pop();
    cout << cur << " ";
    for (auto x : gr[cur]) {
      if (!vis[x]) {
        vis[x] = 1;
        Q.push(x);
      }
    }
  }
}
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1)
    return a;
  else {
    long long res = (power(a, b / 2));
    if (b % 2) {
      return (res * res * a);
    } else {
      return res * res;
    }
  }
}
bool isPrime(int n) {
  if (n <= 1) return true;
  for (int i = 2; i < n; i++)
    if (n % i == 0) return false;
  return true;
}
long long int po(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b % 2) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b = b / 2;
  }
  return ans;
}
bool tr(int a, int b, int c) {
  return ((a + b > c) && (a + c > b) && (b + c > a));
}
bool seg(int a, int b, int c) {
  return ((a == b + c) || (b == a + c) || (c == a + b));
}
int greatestofthree(int num1, int num2, int num3) {
  if (num1 > num2 && num1 > num3) {
    return num1;
  } else if (num2 > num1 && num2 > num3) {
    return num2;
  } else {
    return num3;
  }
}
int smallestofthree(int a, int b, int c) {
  if (a <= b && a <= c)
    return a;
  else if (b <= a && b <= c)
    return b;
  else
    return c;
}
int middleNumber(int num1, int num2, int num3) {
  int middle = 0;
  if (num1 > num2) {
    if (num2 > num3) {
      return num2;
    } else if (num3 > num1) {
      return num1;
    } else {
      return num3;
    }
  } else {
    if (num2 < num3) {
      return num2;
    } else if (num3 < num1) {
      return num1;
    } else {
      return num3;
    }
  }
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool isnotEXpo(double result) {
  long result2 = (long)result;
  if (result2 == result) {
    return true;
  } else {
    return false;
  }
}
double log_a_to_base_b(long long int a, long long int b) {
  return log(a) / log(b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
string decimalToBinary(long long n) {
  string s = bitset<64>(n).to_string();
  const auto loc1 = s.find('1');
  if (loc1 != string::npos) return s.substr(loc1);
  return "0";
}
bool akku() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v;
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    v.push_back(a);
  }
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    m[v[i]] = 0;
  }
  for (int i = 0; i < n; i++) {
    m[v[i]]++;
  }
  int highest = 0;
  for (auto it = m.begin(); it != m.end(); ++it) {
    if (it->second > highest) {
      highest = it->second;
    }
  }
  if (highest % k != 0) {
    int div = highest / k;
    highest = k * (div + 1);
    cout << highest * m.size() - n << endl;
  } else {
    cout << highest * m.size() - n << endl;
  }
  return true;
}
int main() {
  long long int t;
  t = 1;
  while (t--) {
    akku();
  }
  return 0;
}
