#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
long long logPow(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans *= a;
    }
    a *= a;
    b = b >> 1;
  }
  return ans;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
unordered_map<long long, vector<long long>> g;
long long modPow(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans *= a;
      ans = (ans + 1000000007) % 1000000007;
    }
    a *= a;
    a = (a + 1000000007) % 1000000007;
    b = b >> 1;
  }
  return ans;
}
int main() {
  long long t = 1;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> vt(n, 0);
    for (int i = 0; i < n; i++) cin >> vt[i];
    unordered_map<int, int> cnt;
    for (auto it : vt) cnt[it]++;
    int ans = 0;
    while (cnt[k] != n) {
      ans++;
      for (int i = k - 1; i >= 1; i--) {
        if (cnt[i] > 0) {
          cnt[i]--;
          cnt[i + 1]++;
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
