#include <bits/stdc++.h>
using namespace std;
template <typename T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <typename T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
template <typename T>
T gcd(const T a, const T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(const T a, const T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
T ceil(const T a, const T b) {
  return (a + b - 1) / b;
}
template <typename T>
long double dist(const T x1, const T y1, const T x2, const T y2) {
  long double x = x1 - x2;
  long double y = y1 - y2;
  return sqrt(x * x + y * y);
}
template <typename T>
void aout(const T *a, const int n) {
  for (int i = 0; i < (n); ++i) cout << a[i] << ' ';
  cout << "\n";
}
template <typename T>
void vout(const vector<T> &v) {
  for (int i = 0; i < ((int)(v).size()); ++i) cout << v[i] << ' ';
  cout << "\n";
}
const int di4[4] = {-1, 0, 1, 0};
const int dj4[4] = {0, 1, 0, -1};
const int di8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dj8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dik[8] = {2, 1, -1, -2, -2, -1, 1, 2};
const int djk[8] = {1, 2, 2, 1, -1, -2, -2, -1};
const int maxn = 100100;
const int mod = 1e9 + 7;
const int inf = INT_MAX;
const long double eps = 1e-9;
const long double pi = acos(-1.0);
int n, k;
int a[maxn];
bool vis[maxn];
void solve() {
  cin >> n >> k;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
  }
  int ans = 0;
  while (1) {
    vector<int> v;
    for (int i = 0; i < (n); ++i) {
      if (a[i] < k) {
        v.push_back(a[i]);
      }
    }
    sort((v).begin(), (v).end());
    v.resize(unique((v).begin(), (v).end()) - v.begin());
    if ((int)(v).size() == 0) {
      break;
    }
    memset(vis, int(0), (int)sizeof(vis));
    for (int i = 0; i < ((int)(v).size()); ++i) {
      for (int j = 0; j < (n); ++j) {
        if (v[i] == a[j] && !vis[a[j]]) {
          vis[a[j]] = true;
          ++a[j];
        }
      }
    }
    ++ans;
  }
  cout << (ans) << "\n";
}
void init() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;
  int tc = 1;
  for (int i = 1; i <= (tc); ++i) {
    solve();
  }
  return 0;
}
