#include <bits/stdc++.h>
using namespace std;
typedef struct point {
  int x, y;
  point(){};
  point(int a, int b) {
    x = a;
    y = b;
  }
} point;
int X[] = {0, 1, -1, 0, -1, 1, -1, 1};
int Y[] = {1, 0, 0, -1, -1, 1, 1, -1};
string inttostr(int num) {
  string res;
  stringstream s;
  s << num;
  s >> res;
  return res;
}
vector<int> extract_int(string str) {
  stringstream s;
  s << str;
  vector<int> res;
  int num = -1;
  while ((s >> num)) res.push_back(num);
  return res;
}
int main() {
  int i, n, k;
  cin >> n >> k;
  vector<int> sol(n);
  for (i = 0; i < n; i++) cin >> sol[i];
  int res = 0;
  while (true) {
    if (sol[0] >= k) break;
    for (i = 0; i < n;) {
      int tmp = sol[i];
      while (sol[i] == tmp) i++;
      sol[i - 1]++;
    }
    sort(sol.begin(), sol.end());
    res++;
  }
  cout << res << endl;
}
