#include <bits/stdc++.h>
using namespace std;
class TaskB {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n, k;
    in >> n >> k;
    int temp;
    int freq[k + 1];
    memset(freq, 0, sizeof(freq));
    for (int i = 0; i < n; ++i) {
      in >> temp;
      freq[temp]++;
    }
    int res = 0;
    while (freq[k] != n) {
      for (int i = k - 1; i >= 0; --i) {
        if (freq[i]) freq[i + 1]++, freq[i]--;
      }
      res++;
    }
    out << res;
  }
};
int main() {
  TaskB solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
