#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int inf = 1 << 28;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long In() {
  long long x;
  cin >> x;
  return x;
}
double inreal() {
  double x;
  scanf("%lf", &x);
  return x;
}
string instr() {
  char buf[1001];
  scanf("%s", buf);
  return (string)buf;
}
int main() {
  int i, j, n = in(), k = in(), res = 0;
  map<int, int> mp, tmp;
  for ((i) = (0); (i) < (int)(n); (i)++) mp[in()]++;
  for (res = 0; mp.size() > 1 or mp.begin()->first != k; res++) {
    int min_num = inf;
    tmp.clear();
    for (__typeof((mp).begin()) it = (mp).begin(); it != (mp).end(); ++it) {
      if (it->first != k) {
        it->second -= 1;
        if (it->second) tmp[it->first] += it->second;
        tmp[it->first + 1] += 1;
      } else {
        tmp[it->first] += it->second;
      }
    }
    mp = tmp;
  }
  cout << res << endl;
  return 0;
}
