#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, x, k, m, s, p, a, n, b;
  int rifat[10000];
  while (cin >> n >> k) {
    for (i = 0; i < n; i++) {
      cin >> rifat[i];
    }
    int p = 0;
    sort(rifat, rifat + n);
    s = rifat[0];
    p = 0;
    while (rifat[0] < k) {
      s = rifat[0];
      a = 0;
      for (i = 0; i < n; i++) {
        if (rifat[i] == s) {
          rifat[i]++;
          s++;
          a++;
        } else if (rifat[i] > s) {
          s = rifat[i]++;
          s++;
        }
        a++;
      }
      if (a == 0) {
        s++;
      }
      sort(rifat, rifat + n);
      p++;
    }
    cout << p << endl;
  }
}
