#include <bits/stdc++.h>
using namespace std;
int N, K;
int A[200];
int main() {
  int t = 0;
  int s;
  cin >> N >> K;
  A[N + 1] = K;
  for (int i = 1; i <= N; i++) cin >> A[i];
  for (int j = 1; j <= N; j++)
    if (A[j] != K) {
      t = 1;
    }
  if (!t) {
    cout << 0 << endl;
    ;
    return 0;
  }
  int i = 0;
  while (1) {
    i++;
    t = 0;
    for (int j = 1; j <= N; j++)
      if (A[j] < A[j + 1]) A[j]++;
    for (int j = 1; j <= N; j++)
      if (A[j] != K) {
        t = 1;
      }
    if (!t) {
      cout << i << endl;
      ;
      return 0;
    }
  }
  return 0;
}
