#include <bits/stdc++.h>
using namespace std;
const int mod = 1000003;
long double pi = 3.1415926536;
const int mx = 1000003;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long bp(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long p(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return n / i;
    }
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long a[n + 1], ans = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  while (1) {
    bool t = 0;
    for (long long i = n; i >= 1;) {
      if (a[i] < k) {
        long long x = a[i], j = i;
        while (x == a[i] && i >= 1) {
          x = a[i];
          i--;
        }
        a[j]++;
        t = 1;
      } else {
        i--;
      }
    }
    if (t) ans++;
    if (a[1] >= k) break;
  }
  cout << ans;
}
