#include <bits/stdc++.h>
using namespace std;
int n, k, x, p[100010], mn = 1e9, pos;
int main(int argc, char **argv) {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    p[i % k] += x;
  }
  for (int i = 0; i < k; ++i)
    if (p[i] < mn) mn = p[i], pos = i;
  printf("%d", pos + 1);
  return 0;
}
