#include <bits/stdc++.h>
#define pii pair<int, int>
#define f first
#define s second
#define ll long long
#define oo 2000000000
#define piii pair<pii, int>
#define pb push_back
#define mp make_pair
using namespace std;
const int up = 1e6 + 30;
int n, k, a[up];
ll pw[25];
pii work(int d) {
unordered_map<ll, int>cnt;
ll val = 0;
for(int i = 0; i < d; ++i) {
val = val * k + a[i];
}
cnt[val]++;
for(int i = d; i < n; ++i) {
val = val - pw[d - 1] * a[i - d];
val = val * k + a[i];
cnt[val]++;
}
if(cnt[val] == 1) return mp(d, 0);
else {
for(int s = 1; s <= d; ++s) {
val -= pw[d - s] * a[n - d + s - 1];
for(ll i = 0; i < pw[s]; ++i) {
if(!cnt.count(val * pw[s] + i)) {
return mp(d, s);
}
}
}
return mp(0, 0);
}
}
void solve() {
cin >> n >> k;
for(int i = 0; i < n; ++i) {
cin >> a[i];
--a[i];
}
if(k == 1) {
cout << n << " 0\n";
}else { /// in base k
pw[0] = 1;
for(int i = 1; pw[i - 1] < n; ++i) {
pw[i] = pw[i - 1] * k;
}
for(int i = 1; i <= 20; ++i) {
pii cur = work(i);
if(cur.f != 0) {
cout << cur.f << ' ' << cur.s << '\n';
break;
}
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
int t = 1;
//cin >> t;
while(t--) {
solve();
}
return 0;
}
/*
10 2
1 2 1 1 2 2 1 2 1 1
*/
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgcGlpIHBhaXI8aW50LCBpbnQ+CiNkZWZpbmUgZiBmaXJzdAojZGVmaW5lIHMgc2Vjb25kCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgb28gMjAwMDAwMDAwMAojZGVmaW5lIHBpaWkgcGFpcjxwaWksIGludD4KI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBtcCBtYWtlX3BhaXIKCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IHVwID0gMWU2ICsgMzA7CmludCBuLCBrLCBhW3VwXTsKbGwgcHdbMjVdOwoKcGlpIHdvcmsoaW50IGQpIHsKICAgIHVub3JkZXJlZF9tYXA8bGwsIGludD5jbnQ7CiAgICBsbCB2YWwgPSAwOwogICAgZm9yKGludCBpID0gMDsgaSA8IGQ7ICsraSkgewogICAgICAgIHZhbCA9IHZhbCAqIGsgKyBhW2ldOwogICAgfQogICAgY250W3ZhbF0rKzsKICAgIGZvcihpbnQgaSA9IGQ7IGkgPCBuOyArK2kpIHsKICAgICAgICB2YWwgPSB2YWwgLSBwd1tkIC0gMV0gKiBhW2kgLSBkXTsKICAgICAgICB2YWwgPSB2YWwgKiBrICsgYVtpXTsKICAgICAgICBjbnRbdmFsXSsrOwogICAgfQogICAgaWYoY250W3ZhbF0gPT0gMSkgcmV0dXJuIG1wKGQsIDApOwogICAgZWxzZSB7CiAgICAgICAgZm9yKGludCBzID0gMTsgcyA8PSBkOyArK3MpIHsKICAgICAgICAgICAgdmFsIC09IHB3W2QgLSBzXSAqIGFbbiAtIGQgKyBzIC0gMV07CiAgICAgICAgICAgIGZvcihsbCBpID0gMDsgaSA8IHB3W3NdOyArK2kpIHsKICAgICAgICAgICAgICAgIGlmKCFjbnQuY291bnQodmFsICogcHdbc10gKyBpKSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBtcChkLCBzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gbXAoMCwgMCk7CiAgICB9Cn0Kdm9pZCBzb2x2ZSgpIHsKICAgIGNpbiA+PiBuID4+IGs7CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICAgICAgY2luID4+IGFbaV07CiAgICAgICAgLS1hW2ldOwogICAgfQogICAgaWYoayA9PSAxKSB7CiAgICAgICAgY291dCA8PCBuIDw8ICIgMFxuIjsKICAgIH1lbHNlIHsgLy8vIGluIGJhc2UgawogICAgICAgIHB3WzBdID0gMTsKICAgICAgICBmb3IoaW50IGkgPSAxOyBwd1tpIC0gMV0gPCBuOyArK2kpIHsKICAgICAgICAgICAgcHdbaV0gPSBwd1tpIC0gMV0gKiBrOwogICAgICAgIH0KICAgICAgICBmb3IoaW50IGkgPSAxOyBpIDw9IDIwOyArK2kpIHsKICAgICAgICAgICAgcGlpIGN1ciA9IHdvcmsoaSk7CiAgICAgICAgICAgIGlmKGN1ci5mICE9IDApIHsKICAgICAgICAgICAgICAgIGNvdXQgPDwgY3VyLmYgPDwgJyAnIDw8IGN1ci5zIDw8ICdcbic7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQppbnQgbWFpbigpCnsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgaW50IHQgPSAxOwogICAgLy9jaW4gPj4gdDsKICAgIHdoaWxlKHQtLSkgewogICAgICAgIHNvbHZlKCk7CiAgICB9CiAgICByZXR1cm4gMDsKfQoKLyoKCjEwIDIKMSAyIDEgMSAyIDIgMSAyIDEgMQoKKi8K