#include <bits/stdc++.h>
using namespace std;
int arr[102];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    arr[x]++;
  }
  bool b = true;
  int cnt = 0;
  while (b) {
    for (int i = k - 1; i >= 1; --i) {
      if (arr[i]) {
        b = false;
        arr[i + 1]++;
        arr[i]--;
      }
    }
    if (b == false) {
      b = true;
      ++cnt;
    } else {
      b = false;
    }
  }
  cout << cnt;
  return 0;
}
