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