#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
int sum[maxn];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    sum[i % k] += x;
  }
  sum[k] = sum[0];
  int Min = inf, ans = -1;
  for (int i = 1; i <= k; i++) {
    if (sum[i] < Min) {
      Min = sum[i];
      ans = i;
    }
  }
  printf("%d\n", ans);
  return 0;
}
