#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
const long long INF = 1e15;
long long a[N], sum, mmin;
int main() {
  int n, k, ans;
  mmin = INF;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  int tmp;
  for (int i = 1; i <= k; i++) {
    tmp = i;
    sum = 0;
    while (tmp <= n) {
      sum = sum + a[tmp];
      tmp = tmp + k;
    }
    if (sum < mmin) {
      mmin = sum;
      ans = i;
    }
  }
  printf("%d\n", ans);
  return 0;
}
