#include <bits/stdc++.h>
using namespace std;
bool check(int arr[], int size, int k) {
  for (int i = 0; i < size; i++) {
    if (arr[i] != k) return false;
  }
  return true;
}
int main() {
  int n, k;
  cin >> n >> k;
  int ranks[n];
  for (int i = 0; i < n; i++) cin >> ranks[i];
  int counter = 0;
  while (!check(ranks, n, k)) {
    int comp = 0;
    for (int i = 0; i < n; i++) {
      if (ranks[i] != comp && ranks[i] < k) {
        comp = ranks[i];
        ranks[i]++;
      }
    }
    sort(ranks, ranks + n);
    counter++;
  }
  cout << counter << endl;
}
