#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e2 + 100;
int arr[MAXN];
vector<int> ans;
int main() {
  std::ios::sync_with_stdio(false);
  int n, k, ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  arr[n] = k;
  while (arr[0] < k) {
    ans += 1;
    for (int i = 0; i < n; ++i) {
      if (arr[i] < arr[i + 1] && arr[i] < k) {
        arr[i] += 1;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
