#include <bits/stdc++.h>
using namespace std;
const int MAX = 101;
int n, k, arr[MAX], arr2[MAX], tmp, c;
bool train = 1;
void update() {
  for (int i = 1; i < k; i++) arr[i] = arr2[i];
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &tmp);
    arr[tmp]++;
    arr2[tmp]++;
  }
  while (train) {
    train = 0;
    for (int i = 1; i < k; i++)
      if (arr[i]) {
        train = 1;
        arr2[i]--;
        arr2[i + 1]++;
      }
    c += train;
    update();
  }
  printf("%d\n", c);
  return 0;
}
