#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gcd(T a, T b) {
  while (b != 0) swap(b, a %= b);
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a[1000];
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a[x].push_back(x);
  }
  int ans = 0;
  while (1) {
    bool flag = false;
    vector<int> temp;
    for (int i = 1; i < k; ++i) {
      if (a[i].size()) {
        a[i].pop_back();
        temp.push_back(i + 1);
        flag = true;
      }
    }
    if (!flag)
      break;
    else {
      for (auto x : temp) a[x].push_back(x);
      ++ans;
    }
  }
  cout << ans;
  return 0;
}
