#include <bits/stdc++.h>
using namespace std;
int A[210];
int vis[210], temp[210];
int main() {
  int N, K;
  cin >> N >> K;
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    vis[A[i]]++;
    sum += K - A[i];
  }
  int Ans = 0;
  while (vis[K] != N) {
    for (int i = 1; i < K; i++) {
      if (vis[i]) {
        vis[i]--;
        temp[i + 1] = 1;
      } else {
        temp[i + 1] = 0;
      }
    }
    for (int i = 2; i <= K; i++) {
      vis[i] += temp[i];
    }
    Ans++;
  }
  cout << Ans;
  return 0;
}
