#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, k, d;
cin >> n >> k >> d;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
ll maxPr = -1;
int startInd = -1;
ll sum = 0;
int left = 0;
for (int right = 0; right < n; ++right) {
sum += a[right];
//maintain size of k
if (right - left + 1 > k) {
sum -= a[left];
left++;
}
// When window size == k, check divisibility
if (right - left + 1 == k) {
if (sum % d == 0) {
ll tempPr = 1;
for (int i = left; i <= right; ++i) {
tempPr *= a[i];
}
if (startInd == -1 || tempPr > maxPr) {
maxPr = tempPr;
startInd = left;
}
}
}
}
if (startInd == -1)
cout << -1 << endl;
else
cout << startInd + 1 << " " << startInd + k << endl;
return 0;
}