#include <bits/stdc++.h>
using namespace std;
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int count = 0;
  while (a[0] != k) {
    for (int i = 1; i < n; i++) {
      if (a[i] != a[i - 1]) a[i - 1]++;
    }
    if (a[n - 1] != k) a[n - 1]++;
    count++;
  }
  cout << count;
}
