#include <bits/stdc++.h>
using namespace std;
int n, k;
int r[100 + 10];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> r[i];
  int ans = 0;
  while (true) {
    if (r[0] == k) break;
    ans++;
    for (int i = 1; i < n; i++)
      if (r[i] != r[i - 1]) r[i - 1]++;
    if (r[n - 1] < k) r[n - 1]++;
  }
  cout << ans << endl;
  return 0;
}
