#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(),x.end()
#define answer(x) cout << (x ? "YES\n" : "NO\n")
#define test ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T; cin >> T; while(T--)
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define F first
#define S second
using namespace std;
const int N = 200100;
ll n, d, a[N];
int main()
{
ll ans = 0;
cin >> n >> d;
for(int i=1 ; i<=n;i ++) cin >> a[i];
for(int i=1 ;i<=n; i++) if(a[i] == d)
{
int j = i;
ll l_ans = 0;
while(i <= n && a[i] == d)
l_ans ++, i ++;
ans = max(ans, l_ans);
i --;
}
if(d && ans && (ans % 2 == 0))
ans --;
cout << ans;
}
Copy