#include <bits/stdc++.h>
using namespace std;
int a[100];
int main(void) {
  int i, n, d, j, k, sum;
  while (cin >> n >> k) {
    for (i = 0; i < n; i++) cin >> a[i];
    sum = 0;
    while (a[0] != k) {
      for (i = n - 1; i >= 0;) {
        d = a[j = i];
        while (i >= 0 && a[i] == d) i--;
        if (a[j] < k) a[j]++;
      }
      sum++;
    }
    cout << sum << endl;
  }
  return 0;
}
