#include <bits/stdc++.h>
using namespace std;
int a[210], b[210], c;
int main() {
  int n, m;
  cin >> n >> m;
  int j = 0;
  int count = 0;
  memset(a, 0, sizeof(a));
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (a[0] < m) {
    int i = 0;
    while (a[i] < m && i < n) {
      if (a[i] != a[i + 1]) {
        a[i]++;
      }
      i++;
    }
    count++;
  }
  cout << count << endl;
}
