#include <bits/stdc++.h>
using namespace std;
void Fast_Read_Out() {
  ios_base::sync_with_stdio(0);
  cin.tie(), cout.tie();
}
void Random() {
  unsigned int seed;
  asm("rdtsc" : "=A"(seed));
  srand(seed);
}
unsigned int Time() {
  unsigned int time = clock() / 1000.00;
  return time;
}
const int inf = int(1e9) + 123;
const int N = int(1e5) + 123;
int a[N];
set<int> s;
int main() {
  Random();
  Fast_Read_Out();
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  for (int i = 1; i <= n; i++) cin >> a[i], cnt += (a[i] == k);
  if (cnt == n) cout << 0 << endl, exit(0);
  int res = 0;
  while (true) {
    s.clear();
    for (int i = 1; i <= n; i++)
      if (a[i] < k) s.insert(a[i]);
    for (int i = 1; i <= n; i++) {
      if (a[i] == *s.begin()) {
        a[i]++;
        s.erase(s.begin());
      }
    }
    sort(a + 1, a + n + 1);
    res++;
    s.clear();
    for (int i = 1; i <= n; i++) s.insert(a[i]);
    if ((int)(s.size()) == 1 && *s.begin() == k) break;
  }
  cout << res << endl;
}
