#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    vec.push_back(x);
  }
  sort(vec.begin(), vec.end());
  int count = 0;
  while (vec[0] < k) {
    int last = -1;
    bool flag = false;
    for (int i = 0; i < n; i++) {
      if (vec[i] != last) {
        last = vec[i];
        vec[i]++;
        flag = true;
      }
    }
    if (flag) {
      count++;
    }
    sort(vec.begin(), vec.end());
  }
  cout << count << endl;
}
