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