#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, x, ans = 0;
  scanf("%d %d", &n, &k);
  vector<int> vc;
  for (int j = 0; j < n; j++) {
    scanf("%d", &x);
    vc.push_back(x);
  }
  while (1) {
    int flg = 0;
    for (int j = 0; j < n; j++) {
      if (vc[j] < k) {
        int val = vc[j];
        vc[j]++;
        flg = 1;
        if (j + 1 < n)
          for (int k = j + 1; k < n; k++) {
            if (val == vc[k]) {
              j++;
            } else
              break;
          }
      }
    }
    sort(vc.begin(), vc.end());
    if (flg == 0)
      break;
    else
      ans++;
  }
  printf("%d\n", ans);
  return 0;
}
