#include <bits/stdc++.h>
#pragma hdrstop
using namespace std;
#pragma argsused
int main(int argc, char* argv[]) {
  int n, k, sum = 0, tmp;
  cin >> n >> k;
  int mas[1000] = {0};
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    mas[tmp]++;
  }
  while (1) {
    int end = 0;
    for (int i = k - 1; i >= 0; --i) {
      if (mas[i] > 0) {
        end = 1;
        mas[i]--;
        mas[i + 1]++;
      }
    }
    if (end == 0) break;
    ++sum;
  }
  cout << sum;
  return 0;
}
