#include <bits/stdc++.h>
using namespace std;
const int N = 248;
int a[N], l, r, n, k, x, t, ans, cnt;
int main() {
  cin >> n >> k >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (a[i] == x) {
      cnt = 0;
      r = i;
      l = i;
      while (a[r] == a[l]) {
        t = 2;
        while (r < n - 1 && a[r + 1] == a[r]) {
          t++;
          r++;
        }
        while (l > 0 && a[l - 1] == a[l]) {
          t++;
          l--;
        }
        l--;
        r++;
        if (t == 2) break;
        cnt += t;
        if (l < 0 || r > n - 1) break;
      }
      ans = max(ans, cnt - 1);
    }
  }
  cout << ans;
}
