#include <bits/stdc++.h>
using namespace std;
int main() {
  int testCase, x, y, n, k, tell[100000 + 20], minM, now, res;
  minM = 1 << 30;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> tell[i];
  for (int i = 1; i <= k; i++) {
    now = tell[i];
    int j = i + k;
    if (j > n) j -= n;
    for (; j != i; j += k) {
      if (j > n) j -= n;
      if (j == i) break;
      now += tell[j];
    }
    if (minM > now) {
      res = i;
      minM = now;
    }
  }
  cout << res << endl;
  return 0;
}
