#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int judge(int a[], int n, int k) {
  for (int i = 0; i < n; i++) {
    if (a[i] != k) {
      return false;
    }
  }
  return true;
}
int main() {
  int n, k;
  while (~scanf("%d %d", &n, &k)) {
    int a[100 + 10], vis[100 + 10];
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    int ans = 0;
    while (!judge(a, n, k)) {
      memset(vis, 0, sizeof(vis));
      for (int i = 0; i < n; i++) {
        if (vis[a[i]] == 0 && a[i] < k) {
          vis[a[i]] = 1;
          a[i]++;
        }
      }
      ans++;
    }
    printf("%d\n", ans);
  }
}
