#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, arr[100010], k, aux, men, res;
int main() {
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) scanf("%d", &arr[i]);
  men = 999999999;
  for (i = 0; i < k; i++) {
    for (j = i; j < n; j += k) {
      aux += arr[j];
    }
    if (aux < men) {
      men = aux;
      res = i;
    }
    aux = 0;
  }
  printf("%d\n", res + 1);
}
