#include <bits/stdc++.h>
using namespace std;
long long int inverse(long long int i) {
  if (i == 1) return 1;
  return ((long long)(pow(10, 9) + 7) -
          (((long long)(pow(10, 9) + 7) / i) *
           inverse((long long)(pow(10, 9) + 7) % i)) %
              (long long)(pow(10, 9) + 7) +
          (long long)(pow(10, 9) + 7)) %
         (long long)(pow(10, 9) + 7);
}
long long int nCr(long long n, long long r) {
  long long product = 1;
  if (n >= r && n >= 0 && r >= 0) {
    for (long long i = n; i >= n - r + 1; i--) {
      product = (product % (long long)(pow(10, 9) + 7) * i %
                 (long long)(pow(10, 9) + 7)) %
                (long long)(pow(10, 9) + 7);
    }
    for (long long i = 1; i <= r; i++) {
      product = (product % (long long)(pow(10, 9) + 7) * inverse(i) %
                 (long long)(pow(10, 9) + 7)) %
                (long long)(pow(10, 9) + 7);
    }
    return product;
  }
  return 0;
}
int mod(int n) { return n > 0 ? n : -n; }
void Sieve(int n, vector<bool>& primes) {
  for (int i = 0; i < primes.size(); i++) primes[i] = true;
  for (int p = 2; p * p <= n; p++) {
    if (primes[p] == true) {
      for (int i = p * p; i <= n; i += p) primes[i] = false;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int arr[n];
  int H[101] = {0};
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    H[arr[i]]++;
  }
  int c = 0;
  while (1) {
    int flag = 0;
    for (int i = k - 1; i >= 1; i--) {
      if (H[i] != 0) {
        H[i + 1]++;
        H[i]--;
        flag = 1;
      }
    }
    if (flag == 1)
      c++;
    else
      break;
  }
  cout << c << endl;
  return 0;
}
