#include <bits/stdc++.h>
using namespace std;
static const auto fast = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  return nullptr;
}();
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> A(k + 1, 0);
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    A[temp]++;
  }
  long long i = k - 1, step = 0;
  if (A[k] == n) {
    cout << 0;
    return;
  }
  while (A[k] != n) {
    if (A[i] != 0) {
      A[i]--;
      A[i + 1]++;
    }
    if (i > 0 && A[k] != n) {
      i--;
    } else {
      i = k - 1;
      step++;
    }
  }
  cout << step;
  return;
}
int32_t main() {
  solve();
  return 0;
}
