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