#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > Q;
const int INF = 1e9 + 9;
long int pow(long int a, long int b, int m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  while (1) {
    if (a[1] == k) break;
    for (int i = 1; i <= n; i++) {
      if (a[i] < k && a[i] != a[i + 1]) {
        a[i]++;
      }
    }
    ans++;
  }
  cout << ans << endl;
}
