#include <bits/stdc++.h>
int a[100005], b[100005];
int main() {
  int i, n, k, j, m, min;
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < k; i++) {
    for (j = i; j < n; j = j + k) b[i] = b[i] + a[j];
  }
  m = 0;
  min = b[0];
  for (i = 0; i < k; i++) {
    if (b[i] < min) {
      min = b[i];
      m = i;
    }
  }
  printf("%d\n", m + 1);
  return 0;
}
