#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int mod = 1e5 + 7;
long long f[1000];
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  long long n, k, m, ans = 0;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> m;
    if (m >= k) m = k;
    f[m]++;
  }
  if (f[k] == n)
    cout << 0;
  else {
    while (true) {
      for (int i = (k)-1; i >= 0; i--) {
        if (f[i]) {
          f[i]--;
          f[i + 1]++;
        }
      }
      ans++;
      if (f[k] == n) {
        return cout << ans, 0;
      }
    }
  }
  return 0;
}
