#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, in, res = 0;
  cin >> n >> k;
  int r[k], temp[k];
  for (int(i) = 0; (i) < (k); ++(i)) r[i] = 0;
  for (int(i) = 0; (i) < (n); ++(i)) {
    cin >> in;
    r[in - 1]++;
  }
  while (r[k - 1] != n) {
    for (int(i) = 0; (i) < (k); ++(i)) temp[i] = r[i];
    for (int(i) = 0; (i) < (k - 1); ++(i)) {
      if (r[i] > 0) {
        temp[i]--;
        temp[i + 1]++;
      }
    }
    for (int(i) = 0; (i) < (k); ++(i)) r[i] = temp[i];
    res++;
  }
  cout << res;
  return 0;
}
