#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, k;
  cin >> n >> k;
  int *s = new int[n];
  int i = n;
  while (i--) {
    cin >> s[n - i - 1];
  }
  int cnt = 0;
  while (s[0] != k) {
    i = n;
    int last = k;
    while (i--) {
      if (s[i] < last) {
        last = s[i];
        ++s[i];
      }
    }
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
