#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vec(n + 1);
  int low = k;
  for (int i = 1; i <= n; i++) {
    cin >> vec[i];
  }
  int count = 0;
  while (1) {
    if (vec[1] == k) break;
    for (int i = 1; i < n; i++) {
      if (vec[i + 1] == vec[i])
        continue;
      else
        vec[i]++;
    }
    vec[n]++;
    count++;
  }
  cout << count;
  return 0;
}
