#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int inf = 1e9;
int a, pre[MAXN] = {0};
int main() {
  int n, k, ans = 0;
  int min = inf;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    if (i % k != 0) {
      pre[i % k] = pre[i % k] + a;
    } else
      pre[k] = pre[k] + a;
  }
  for (int i = 1; i <= k; i++) {
    if (pre[i] < min) {
      ans = i;
      min = pre[i];
    }
  }
  cout << ans;
}
