#include <bits/stdc++.h>
using namespace std;
int a[107];
stack<int> Q[100];
int cmp(int a, int b) { return a > b; }
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + 1 + n, cmp);
  int ans = 0;
  int tmp = -1;
  int flag = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] != k) {
      flag = 0;
      break;
    }
  }
  if (flag) {
    printf("0\n");
    return 0;
  }
  while (1) {
    tmp = -1;
    ans++;
    for (int i = 1; i <= n; i++) {
      if (a[i] == k)
        continue;
      else if (tmp == a[i])
        continue;
      else {
        tmp = a[i];
        a[i]++;
      }
    }
    int flag = 1;
    for (int i = 1; i <= n; i++) {
      if (a[i] != k) {
        flag = 0;
        break;
      }
    }
    if (flag) break;
  }
  printf("%d", ans);
  return 0;
}
