#include <bits/stdc++.h>
using namespace std;
int r[105], n, k;
bool ok() {
  for (int i = 1; i <= n; i++)
    if (r[i] != k) return false;
  return true;
}
int main() {
  int i, j;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> r[i];
  int cnt = 0;
  r[n + 1] = -1;
  while (!ok()) {
    cnt++;
    for (i = 1; i <= n; i++) {
      if (r[i] == k) continue;
      if (r[i] != r[i + 1]) r[i]++;
    }
  }
  cout << cnt << endl;
  return 0;
}
