#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int soldiers[101];
  for (int i = 0; i < n; i++) cin >> soldiers[i];
  int numberCoins = 0;
  while (soldiers[0] < k) {
    numberCoins++;
    for (int i = 0; i < n - 1; i++) {
      if (soldiers[i] < soldiers[i + 1]) soldiers[i]++;
    }
    if (soldiers[n - 1] != k) soldiers[n - 1]++;
  }
  cout << numberCoins << endl;
  return 0;
}
