#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k;
  int a;
  int coins;
  vector<int> v1, v2;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    v1.push_back(a);
  }
  v2 = v1;
  coins = 0;
  while (v2[0] != k) {
    v2[0]++;
    for (int i = 0; i < n - 1; i++) {
      if (v1[i + 1] > v1[i]) {
        v2[i + 1]++;
      }
    }
    sort(v2.begin(), v2.end());
    v1 = v2;
    coins++;
  }
  cout << coins;
  return 0;
}
