#include <bits/stdc++.h>
using namespace std;
int cmp(int a, int b) { return a < b; }
int main() {
  int n, k;
  while (scanf("%d%d", &n, &k) != EOF) {
    int a[105], i, sum = 0;
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n, cmp);
    while (a[0] < k) {
      for (i = 0; i < n; i++) {
        if (a[i] == a[i + 1] && i == n - 2)
          a[i + 1]++;
        else {
          if (a[i] == a[i + 1])
            continue;
          else {
            a[i]++;
            continue;
          }
        }
      }
      sum++;
    }
    cout << sum << endl;
  }
}
