#include <bits/stdc++.h>
using namespace std;
const int mxN = 5e5 + 5;
const int mod = 1e9 + 7;
const int INF = 1e9;
long long dp[mxN][3];
long long pref[mxN];
void solve() {
  int n, k = 2, m;
  cin >> n >> m;
  int x;
  int arr[n + 1];
  arr[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    arr[i] = x;
    pref[i] = pref[i - 1] + x;
  }
  int a = 0, b = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = dp[i - 1][j];
      if (i >= j * m) {
        if (dp[i][j] < dp[i - m][j - 1] + pref[i] - pref[i - m]) {
          b = i - m;
          dp[i][j] = dp[i - m][j - 1] + pref[i] - pref[i - m];
        }
      }
    }
  }
  int sum = 0;
  int need = dp[n][k] - (pref[b + m] - pref[b]);
  for (int i = 0; i < b; i++) {
    if (i < m - 1) {
      sum += arr[i + 1];
    } else {
      sum -= arr[i + 1 - m];
      sum += arr[i + 1];
      if (sum == need) {
        a = i - m + 1;
        break;
      }
    }
  }
  cout << a + 1 << " " << b + 1 << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(12) << fixed;
  solve();
  return 0;
}
