#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[102];
int main() {
  scanf("%d%d\n", &n, &k);
  for (int i = 0, _n = (n); i < _n; i++) {
    scanf("%d", &a[i]);
  }
  a[n] = k;
  int t = 0;
  while (a[0] != k) {
    t++;
    for (int i = 0, _n = (n); i < _n; i++) {
      if (a[i] != a[i + 1]) {
        a[i]++;
      }
    }
  }
  printf("%d\n", t);
  return 0;
}
