#include <iostream>
using namespace std;
const int MAX_LENGTH = 20;
int main() {
int x, n, v[MAX_LENGTH + 1], start = 0, stop = 0, seqMax = 0;
cin >> x >> n;
int currentStartSeqIndex = -1, currentSeqLen = 0 ;
for (int i = 1; i <= n; ++i) {
cin >> v[i];
if (v[i] == 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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9MRU5HVEggPSAyMDsKCmludCBtYWluKCkgewoJaW50IHgsIG4sIHZbTUFYX0xFTkdUSCArIDFdLCBzdGFydCA9IDAsIHN0b3AgPSAwLCBzZXFNYXggPSAwOwoJY2luID4+IHggPj4gbjsKCWludCBjdXJyZW50U3RhcnRTZXFJbmRleCA9IC0xLCBjdXJyZW50U2VxTGVuID0gMCA7Cglmb3IgKGludCBpID0gMTsgaSA8PSBuOyArK2kpIHsKCQljaW4gPj4gdltpXTsKCQlpZiAodltpXSA9PSB4KSB7CgkJCWlmKGN1cnJlbnRTdGFydFNlcUluZGV4ID09IC0xKSB7CgkJCQljdXJyZW50U3RhcnRTZXFJbmRleCA9IGk7CgkJCX0KCQkJKytjdXJyZW50U2VxTGVuOwoJCQlpZiAoY3VycmVudFNlcUxlbiA+IHNlcU1heCkgewoJCQkJc2VxTWF4ID0gY3VycmVudFNlcUxlbjsKCQkJCXN0YXJ0ID0gY3VycmVudFN0YXJ0U2VxSW5kZXg7CgkJCQlzdG9wID0gaTsKCQkJfQoJCX0gZWxzZSB7CgkJCWN1cnJlbnRTdGFydFNlcUluZGV4ID0gLTE7CgkJCWN1cnJlbnRTZXFMZW4gPSAwOwoJCX0KCX0KCWNvdXQgPDwgc3RhcnQgPDwgIiAiIDw8IHN0b3A7CglyZXR1cm4gMDsKfQ==