#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 0, i, j, k = 0, l = 0, arr[300] = {}, brr[300] = {};
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &arr[i]);
  k = 0;
  l = 0;
  while (1) {
    l = 0;
    memset(brr, 0, sizeof(brr));
    for (i = 0; i < n; i++) {
      if (arr[i] < m && brr[arr[i]] == 0) {
        brr[arr[i]] = 1;
        arr[i] += 1;
        l++;
      }
    }
    if (l)
      k++;
    else
      break;
  }
  printf("%d", k);
}
