#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> soldiersByRank;
  soldiersByRank.resize(k);
  for (int i = 0; i < k; i++) {
    soldiersByRank[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    int rank;
    cin >> rank;
    rank--;
    soldiersByRank[rank]++;
  }
  int turns = 0;
  while (soldiersByRank[k - 1] < n) {
    for (int i = k - 2; i >= 0; i--) {
      if (soldiersByRank[i] > 0) {
        soldiersByRank[i]--;
        soldiersByRank[i + 1]++;
      }
    }
    turns++;
  }
  cout << turns;
  return 0;
}
