#include <bits/stdc++.h>
using namespace std;
int a[100002];
int main() {
  int n, k, i, j;
  int sum, mini, min;
  while (scanf("%d%d", &n, &k) != EOF) {
    for (i = 1; i <= n; i++) scanf("%d", &a[i]);
    min = INT_MAX;
    for (i = 1; i <= k; i++) {
      sum = 0;
      for (j = 1; j <= n / k; j++) {
        sum += a[i + (j - 1) * k];
      }
      if (sum < min) {
        min = sum;
        mini = i;
      }
    }
    printf("%d\n", mini);
  }
  return 0;
}
