#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
int a[200], n, m, b[200];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    b[i] = a[i];
  }
  int ans = 0;
  while (true) {
    if (a[0] == m) break;
    b[0]++;
    for (int i = 0; i < n - 1; i++) {
      if (a[i] != a[i + 1]) {
        if (a[i + 1] < m) b[i + 1]++;
      }
    }
    sort(b, b + n);
    for (int i = 0; i < n; i++) {
      a[i] = b[i];
    }
    ans++;
  }
  cout << ans;
  return 0;
}
