#include <bits/stdc++.h>
using namespace std;
int curRank[300];
int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  for (int i = 0, a; i < n; i++) {
    cin >> a;
    curRank[a]++;
  }
  while (curRank[k] != n) {
    ans++;
    vector<int> index;
    for (int i = 1; i < k; i++)
      if (curRank[i]) index.push_back(i);
    for (int i = 0; i < index.size(); i++)
      curRank[index[i]]--, curRank[index[i] + 1]++;
  }
  cout << ans << endl;
}
