#include <fstream>
using namespace std;
int n,c,v[10005],i,j,cul,cc,ll,st,dr,minn=1000000;
int main()
{
ifstream f("panglica.in");
ofstream g("panglica.out");
f>>n>>c;
for(i=1;i<=n;i++) f>>v[i];
for(i=1;i<=n/2+1;i++)
{
for(j=n;j>=n/2-1;j--)
if(v[i]==v[j])
{
cul=v[i];
break;
}
ll=i-1+n-j;
if(ll<minn) minn=ll,cc=cul,st=i,dr=n-j;
}
g<<n-minn<<"\n";
g<<cc<<"\n";
g<<st-1<<"\n";
g<<dr;
f.close();
g.close();
return 0;
}