#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int b[1000];
  for (int i = 0; i <= k; i++) {
    b[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    b[x]++;
  }
  int ans = -1;
  bool flag = true;
  while (flag) {
    flag = false;
    ans++;
    for (int i = k - 1; i > 0; i--) {
      if (b[i] > 0) {
        flag = true;
        b[i]--;
        b[i + 1]++;
      }
    }
  }
  cout << ans;
  return 0;
}
