#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, a[200] = {0}, dp[200] = {0};
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[n - 1] = k - a[n - 1];
  for (i = n - 2; i >= 0; i--) {
    if (k == a[i]) {
      dp[i] = 0;
    } else {
      dp[i] = max(k - a[i], dp[i + 1] + 1);
    }
  }
  cout << dp[0] << endl;
  return 0;
}
