#include <iostream>
using namespace std;
int main() {
int x, n, currentElement, start = 0, stop = 0, seqMax = 0;
cin >> x >> n;
int currentStartSeqIndex = -1, currentSeqLen = 0 ;
for (int i = 1; i <= n; ++i) {
cin >> currentElement;
if (currentElement == x) {
if(currentStartSeqIndex == -1) {
currentStartSeqIndex = i;
}
++currentSeqLen;
if (currentSeqLen > seqMax) {
seqMax = currentSeqLen;
start = currentStartSeqIndex;
stop = i;
}
} else {
currentStartSeqIndex = -1;
currentSeqLen = 0;
}
}
cout << start << " " << stop;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgeCwgbiwgY3VycmVudEVsZW1lbnQsIHN0YXJ0ID0gMCwgc3RvcCA9IDAsIHNlcU1heCA9IDA7CgljaW4gPj4geCA+PiBuOwoJaW50IGN1cnJlbnRTdGFydFNlcUluZGV4ID0gLTEsIGN1cnJlbnRTZXFMZW4gPSAwIDsKCWZvciAoaW50IGkgPSAxOyBpIDw9IG47ICsraSkgewoJCWNpbiA+PiBjdXJyZW50RWxlbWVudDsKCQlpZiAoY3VycmVudEVsZW1lbnQgPT0geCkgewoJCQlpZihjdXJyZW50U3RhcnRTZXFJbmRleCA9PSAtMSkgewoJCQkJY3VycmVudFN0YXJ0U2VxSW5kZXggPSBpOwoJCQl9CgkJCSsrY3VycmVudFNlcUxlbjsKCQkJaWYgKGN1cnJlbnRTZXFMZW4gPiBzZXFNYXgpIHsKCQkJCXNlcU1heCA9IGN1cnJlbnRTZXFMZW47CgkJCQlzdGFydCA9IGN1cnJlbnRTdGFydFNlcUluZGV4OwoJCQkJc3RvcCA9IGk7CgkJCX0KCQl9IGVsc2UgewoJCQljdXJyZW50U3RhcnRTZXFJbmRleCA9IC0xOwoJCQljdXJyZW50U2VxTGVuID0gMDsKCQl9Cgl9Cgljb3V0IDw8IHN0YXJ0IDw8ICIgIiA8PCBzdG9wOwoJcmV0dXJuIDA7Cn0=