#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n, arr[1001], t, i;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  arr[n] = k;
  for (t = 0; arr[0] != arr[n]; t++) {
    for (i = 0; i < n; i++) {
      if (arr[i] != arr[i + 1]) {
        arr[i]++;
      }
    }
  }
  cout << t;
  return 0;
}
