#include <bits/stdc++.h>
using namespace std;
void hinataVSsakura(void);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) hinataVSsakura();
  return 0;
}
struct jutsu {
  long long a, b;
};
bool jutsu_compare(jutsu s1, jutsu s2) { return s1.a < s2.a; }
long long ncr(long long n, long long k) {
  long long res = 1;
  if (k > n - k) k = n - k;
  for (long long i = 0; i < k; ++i) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long min(long long a, long long b) { return (a < b) ? a : b; }
void swap(long long &a, long long &b) {
  a = a ^ b;
  b = a ^ b;
  a = a ^ b;
}
long long index(vector<long long> arr, long long val) {
  auto it = find((arr).begin(), (arr).end(), val);
  if (it != arr.end()) {
    long long ind = it - arr.begin();
    return ind;
  } else
    return -1;
}
void hinataVSsakura(void) {
  long long n, k, cnt = 0;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; ++i) cin >> arr[i];
  while (accumulate(arr, arr + n, 0) != k * n) {
    set<long long> s;
    for (long long i = 0; i < n; ++i) {
      if (s.find(arr[i]) == s.end() && arr[i] < k) {
        s.insert(arr[i]);
        arr[i]++;
      }
    }
    cnt++;
  }
  cout << cnt << endl;
}
