#include <bits/stdc++.h>
using namespace std;
long long int biexp(long long int a, long long int b) {
  long long int res = 1;
  while (b) {
    if (b % 2) res = res * a;
    a = a * a;
    b = b / 2;
  }
  return res;
}
int main() {
  int t = 1;
  while (t--) {
    long long int n, k, x, ans = 0;
    cin >> n >> k;
    map<long long int, long long int> m;
    for (long long int i = 0; i < n; i++) {
      cin >> x;
      m[x]++;
    }
    while (1) {
      if (m.size() == 1 and m[k] == n) break;
      vector<long long int> v, w;
      for (auto it = m.begin(); it != m.end(); it++) {
        if (it->first != k) {
          m[it->first]--;
          if (it->second == 0) v.push_back(it->first);
          w.push_back(it->first + 1);
        }
      }
      for (long long int i = 0; i < v.size(); i++) m.erase(v[i]);
      for (long long int i = 0; i < w.size(); i++) m[w[i]]++;
      ans++;
    }
    cout << ans;
  }
  return 0;
}
