#include "bits/stdc++.h"
using namespace std;
int main(){
int n,d;
cin>>n>>d;
vector<int> v(n);
for(int i = 0 ;i < n ;i++)
cin>>v[i];
int cnt = ,ans = 0;
for(int i = 0 ; i < n; i++)
{
if(v[i] == d)
cnt++;
else
cnt = 0;
if(cnt&1)
ans = max(cnt,ans);
}
cout<<ans;
}