/* Author : Nguyen Thanh Tung */
#include <bits/stdc++.h>
using namespace std;
long long n, k, a[100006], q;
pair<long long, long long> p[100006];
int tknp(int l, int r, int x) {
int ans = -1;
while(l <= r) {
int mid = (l + r) / 2;
if(p[mid].first == x) {
ans = mid;
r = mid - 1;
}
else if(p[mid].first > x) {
r = mid - 1;
}
else {
l = mid + 1;
}
}
return ans;
}
void solve() {
cin >> n >> k;
for(int i = 1; i <= n; ++i) {
cin >> a[i];
}
int s = 0;
for(int i = 1; i <= n; i++){
s += a[i];
if(i >= k) {
p[i] = {s, i - k + 1};
s -= a[i - k + 1];
}
}
sort(p + k, p + n + 1);
cin >> q;
while(q--) {
int x;
cin >> x;
int pos = tknp(k, n, x);
if(pos != -1) {
cout << p[pos].second << " " << p[pos].second + k - 1 << endl;
}
else {
cout << 0 << " " << 0 << endl;
}
}
}
int main () {
solve();
return 0;
}
LyogQXV0aG9yIDogTmd1eWVuIFRoYW5oIFR1bmcgKi8KCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgoKdXNpbmcgbmFtZXNwYWNlICAgICAgICAgICAgICBzdGQ7Cgpsb25nIGxvbmcgbiwgaywgYVsxMDAwMDZdLCBxOwpwYWlyPGxvbmcgbG9uZywgbG9uZyBsb25nPiBwWzEwMDAwNl07CgppbnQgdGtucChpbnQgbCwgaW50IHIsIGludCB4KSB7CglpbnQgYW5zID0gLTE7Cgl3aGlsZShsIDw9IHIpIHsKCQlpbnQgbWlkID0gKGwgKyByKSAvIDI7CgkJaWYocFttaWRdLmZpcnN0ID09IHgpIHsKCQkJYW5zID0gbWlkOwoJCQlyID0gbWlkIC0gMTsKCQl9CgkJZWxzZSBpZihwW21pZF0uZmlyc3QgPiB4KSB7CgkJCXIgPSBtaWQgLSAxOwoJCX0KCQllbHNlIHsKCQkJbCA9IG1pZCArIDE7CQkKCQl9Cgl9CglyZXR1cm4gYW5zOwp9Cgp2b2lkIHNvbHZlKCkgewoJY2luID4+IG4gPj4gazsKCWZvcihpbn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