#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 7;
const int MOD = 1e6 + 9;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long arr[n + 1];
  arr[n] = 0;
  long long sum = 0, reqSum = n * k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  long long ans = 0;
  while (sum != reqSum) {
    for (int i = 0; i < n; i++) {
      if (arr[i] == arr[i + 1]) {
        continue;
      } else if (arr[i] < k) {
        arr[i]++;
        sum++;
      }
    }
    ans++;
  }
  cout << ans << endl;
}
int main() {
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
