#include <bits/stdc++.h>
using namespace std;
bool solve(int cn) {
  int n, k;
  cin >> n >> k;
  vector<int> soldiers(n);
  for (int i = (0); i < (n); i++) cin >> soldiers[i];
  soldiers.push_back(1 << 30);
  int coins = 0;
  while (soldiers[0] < k) {
    coins++;
    for (int i = (0); i < (n); i++) {
      while (soldiers[i] == soldiers[i + 1]) i++;
      soldiers[i]++;
    }
  }
  cout << coins << endl;
  return 0;
}
int main() {
  int cases = 1 << 30;
  if (!cases) cin >> cases;
  for (int cn = 1; cn <= cases && solve(cn); ++cn)
    ;
  return 0;
}
