#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
  int n, k, x;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  bool yes = true;
  for (int i = 0; i < n; i++)
    if (a[i] < k) {
      yes = false;
      break;
    }
  while (!yes) {
    for (int i = 0; i < n; i++)
      if ((a[i] < a[i + 1] || i == n - 1) && a[i] < k) a[i]++;
    yes = true;
    for (int i = 0; i < n; i++)
      if (a[i] < k) {
        yes = false;
        break;
      }
    ans++;
  }
  cout << ans;
  return 0;
}
