#include <bits/stdc++.h>
using namespace std;
int main() {
  short n, k, a, d[110], ans = -1;
  cin >> n >> k;
  for (a = 0; a < n; a++) cin >> d[a];
  set<short> last;
  do {
    last.clear();
    ans++;
    for (a = 0; a < n; a++)
      if (last.find(d[a]) == last.end() && d[a] != k) last.insert(d[a]++);
  } while (!last.empty());
  cout << ans;
}
