#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int Min = 1 << 29, id = -1;
  for (int i = 0; i < k; i++) {
    int count = 0;
    int sum = 0, now = i;
    while (count++ < n / k) {
      sum += a[now];
      now = (now + k) % n;
    }
    if (sum < Min) Min = sum, id = i;
  }
  printf("%d\n", id + 1);
  return 0;
}
