#include <bits/stdc++.h>
using namespace std;
int d[1000000];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < (n); ++i) {
    int(x);
    scanf("%d", &x);
    d[i % k] += x;
  }
  int mi = (int)1e9;
  int id = -1;
  for (int i = 0; i < (k); ++i) {
    if (mi > d[i]) {
      mi = d[i];
      id = i;
    }
  }
  printf("%d\n", id + 1);
  return 0;
}
