#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
int main() {
  int n, k, x, ans = 0;
  cin >> n >> k;
  vector<int> ar(101, 0);
  for (int i = 0; i < n; i++) cin >> x, ar[x]++;
  while (1) {
    if (ar[k] == n) break;
    ++ans;
    for (int last = k - 1; last > 0; --last) {
      if (ar[last] > 0) {
        ar[last]--;
        ar[last + 1]++;
      }
    }
  }
  cout << ans;
  return 0;
}
