#include <bits/stdc++.h>
using namespace std;
double const pi = 3.1415926536;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int c = 0;
  while (true) {
    int t = 0, b[101];
    for (int i = 0; i < 101; i++) b[i] = 0;
    if (a[0] < k) {
      b[a[0]] = 1;
      a[0]++;
      t = 1;
    }
    for (int i = 1; i < n; i++) {
      if (b[a[i]] == 0 && a[i] < k) {
        b[a[i]] = 1;
        a[i]++;
        t = 1;
      }
    }
    if (t == 0)
      break;
    else
      c++;
  }
  cout << c;
}
