#include <bits/stdc++.h>
using namespace std;
int n, k, ans;
int a[101];
bool pp[101];
void solve() {
  while (a[1] != k) {
    memset(pp, 0, sizeof(pp));
    pp[k] = true;
    for (int i = n; i >= 1; i--)
      if (!pp[a[i]]) {
        pp[a[i]] = true;
        ++a[i];
      }
    ++ans;
  }
  printf("%d", ans);
}
void init() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
}
int main() {
  init();
  solve();
}
