#include <bits/stdc++.h>
using namespace std;
queue<string> rat;
queue<string> chw;
queue<string> man;
queue<string> cap;
int a[111] = {0};
int main() {
  int n, k;
  cin >> n >> k;
  int temp;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  int ans = 0;
  while (sum < n * k) {
    sum = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] != a[i + 1]) {
        if (a[i] < k) a[i]++;
      }
    }
    for (int i = 0; i < n; i++) sum += a[i];
    ans++;
  }
  cout << ans << endl;
}
