#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n, k, p, sum = 0, min = 0x7f7f7f7f;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= (n); ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= (k); ++i) {
    sum = 0;
    for (int j = i; j <= n; j += k) {
      sum += a[j];
    }
    if (sum < min) {
      min = sum;
      p = i;
    }
  }
  printf("%d", p);
}
