#include <bits/stdc++.h>
using namespace std;
const int MAX_K = 100000;
const int INF = 1 << 30;
int bs[MAX_K];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    bs[i % k] += a;
  }
  int minb = INF, mini = -1;
  for (int i = 0; i < k; i++)
    if (minb > bs[i]) minb = bs[i], mini = i;
  printf("%d\n", mini + 1);
  return 0;
}
