#include <bits/stdc++.h>
int a[123456];
int main() {
  int n, k, bi = 1, bp = 999999999;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = n - 1; i >= k; i--) a[i - k] += a[i];
  for (int i = 0; i < k; i++) {
    if (a[i] < bp) {
      bp = a[i];
      bi = i + 1;
    }
  }
  printf("%d\n", bi);
  return 0;
}
