#include <bits/stdc++.h>
using namespace std;
int n, k, a[101], res;
vector<int> v[101];
bool b;
void sol() {
  b = false;
  for (int i = 1; i < k; i++) {
    if (!v[i].empty()) {
      a[v[i][0]]++;
      b = true;
      v[i].clear();
    }
  }
  if (!b) {
    cout << res;
    exit(0);
  }
  res++;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    v[a[i]].push_back(i);
  }
  while (true) {
    sol();
    for (int i = 1; i <= n; i++) {
      v[a[i]].push_back(i);
    }
  }
  return 0;
}
