#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define fast ios::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef tree<int, null_type, less<int>,
rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int main(){
fast
int n,d;
cin>>n>>d;
int ans = 0, cur = 0;
for(int i=0;i<n;i++){
int x;
cin>>x;
if(x == d)cur++;
else{
ans = max(ans,cur);
cur = 0;
}
}
ans = max(ans, cur);
if(ans%2==0 && ans > 0 && d > 0)ans--;
cout<<ans<<endl;
return 0;
}
Copy