#include <bits/stdc++.h>
using namespace std;
int A[102];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  int ans = 0;
  int ind = n - 1;
  while (A[0] != k) {
    while (A[ind] == k) ind--;
    if (ind < 0) break;
    ans++;
    int x = A[ind];
    A[ind]++;
    int j = ind - 1;
    while (j >= 0) {
      if (A[j] != x) {
        x = A[j];
        A[j]++;
      }
      j--;
    }
    ind = n - 1;
  }
  printf("%d\n", ans);
}
