#include <bits/stdc++.h>
using namespace std;
int main() {
  long m, n, i, c, a[100] = {0};
  scanf("%ld %ld", &m, &n);
  for (__typeof(m) i = 0; i < (m); i++) {
    scanf("%ld", &a[i]);
  }
  long int x = 0;
  while (1) {
    c = 0;
    for (i = 0; i < m; i++)
      if ((a[i] != a[i + 1] && a[i] < n)) {
        a[i] = a[i] + 1;
        c = 1;
      } else if (i == m - 1 && a[i] < n) {
        a[i] = a[i] + 1;
        c = 1;
      }
    if (c == 0)
      break;
    else
      x++;
  }
  printf("%ld\n", x);
  return 0;
}
