#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, sum = 0, x;
  vector<int> a;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  bool b = true;
  int w = m;
  while (b) {
    w = m;
    b = false;
    for (int i = a.size() - 1; i >= 0; i--)
      if (a[i] < w) {
        w = a[i]++;
        b = true;
      }
    if (b) sum++;
  }
  cout << sum;
  return 0;
}
