#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, task[100100];
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &task[i]);
    }
    int min = 0x7fffffff, minpos = -1;
    for (int i = 0; i < k; i++) {
      int sum = task[i];
      int j = (i + k) % n;
      while (i != j) {
        sum += task[j];
        j = (j + k) % n;
      }
      if (sum < min) {
        min = sum;
        minpos = i;
      }
    }
    cout << minpos + 1 << endl;
  }
  return 0;
}
