#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k, second, ans = 0;
  cin >> n >> k;
  vector<int> sol(k, 0);
  for (int i = 0; i < n; i++) {
    cin >> second;
    sol[second - 1]++;
  }
  while (sol[k - 1] != n) {
    ans++;
    for (int i = k - 2; i >= 0; i--) {
      if (sol[i]) {
        sol[i + 1]++;
        sol[i]--;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
