#include <bits/stdc++.h>
using namespace std;
int arr[300];
int main() {
  int n, k, counter = 0, kCounter = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  while (true) {
    for (int i = 0; i < n; i++) {
      if (arr[i] == k) kCounter++;
    }
    if (kCounter == n) break;
    counter++;
    for (int i = 0; i < n; i++) {
      if (i != n - 1) {
        if (arr[i] != arr[i + 1]) {
          if (arr[i] != k) arr[i]++;
        } else
          continue;
      } else {
        if (arr[i] != k) arr[i]++;
      }
    }
    kCounter = 0;
  }
  cout << counter << "\n";
}
