#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  vector<int> H(k + 1);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    H[A[i]]++;
  }
  int coins = 0;
  while (H[k] != n) {
    vector<int> H2(k + 1);
    coins++;
    for (int i = 1; i < k; i++) {
      if (H[i] > 0) {
        H[i]--;
        H2[i + 1]++;
      }
    }
    for (int i = 1; i <= k; i++) {
      H[i] = H[i] + H2[i];
    }
  }
  cout << coins;
}
