#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k, x, ind = 0;
  cin >> n >> k;
  map<long long, long long> mp;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (ind + k > i) {
      mp[abs(i - ind)] += x;
    } else if (ind + k == i) {
      ind = i;
      mp[abs(i - ind)] += x;
    }
  }
  long long ans, sum = 1e9;
  for (auto i : mp) {
    if (i.second < sum) {
      sum = i.second;
      ans = i.first;
    }
  }
  cout << ++ans;
  return 0;
}
