#include <bits/stdc++.h>
using namespace std;
int n, k, x, ans1, ans2;
int has[100010];
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    memset(has, 0, sizeof(has));
    for (int i = 0; i < n; ++i) {
      scanf("%d", &x);
      has[i % k] += x;
    }
    ans1 = 2147483647;
    ans2 = -1;
    for (int i = 0; i < k; ++i) {
      if (has[i] < ans1) {
        ans1 = has[i];
        ans2 = i + 1;
      }
    }
    printf("%d\n", ans2);
  }
  return 0;
}
