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