#include <bits/stdc++.h>
using namespace std;
int m, n, k, t;
int a[100001];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &t);
    a[i % k] += t;
  }
  m = 0;
  for (int i = 1; i < k; ++i)
    if (a[i] < a[m]) m = i;
  printf("%d\n", m + 1);
}
