#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int st;
  int ed;
} node;
node mark[150];
int ini[150], n, k, cnt, belong[150];
long long solve() {
  long long num = 0;
  while (ini[1] != k) {
    for (int i = 1; i <= cnt; i++) {
      if (mark[i].st == -1) continue;
      if (ini[mark[i].st] == k) continue;
      ini[mark[i].ed] += 1;
      if (mark[i].st == mark[i].ed) {
        if (ini[mark[i].ed] == ini[mark[i].ed + 1]) {
          mark[belong[mark[i].ed + 1]].st = mark[i].ed;
          belong[mark[i].ed] = belong[mark[i].ed + 1];
          mark[i].st = -1;
        }
      } else {
        if (ini[mark[i].ed] == ini[mark[i].ed + 1]) {
          mark[belong[mark[i].ed + 1]].st = mark[i].ed;
          belong[mark[i].ed] = belong[mark[i].ed + 1];
          mark[i].ed = mark[i].ed - 1;
        } else {
          cnt++;
          mark[cnt].st = mark[i].ed;
          mark[cnt].ed = mark[i].ed;
          belong[mark[i].ed] = cnt;
          mark[i].ed = mark[i].ed - 1;
        }
      }
    }
    num++;
  }
  return num;
}
int main() {
  while (scanf("%d %d", &n, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &ini[i]);
    }
    int start = 1, j = 1;
    mark[1].st = 1;
    for (int i = 2; i <= n; i++) {
      if (ini[i] != ini[start]) {
        mark[j].ed = i - 1;
        j++;
        mark[j].st = i;
        start = i;
      }
      belong[i] = j;
    }
    mark[j].ed = n;
    cnt = j;
    printf("%lld\n", solve());
  }
  return 0;
}
