#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, power, maxpos, minpow, minind;
  int sum[100001] = {0};
  cin >> n >> k;
  maxpos = k;
  for (i = 0; i < n; i++) {
    cin >> power;
    sum[i % maxpos] += power;
  }
  minpow = sum[0];
  minind = 0;
  for (i = 1; i < maxpos; i++) {
    if (sum[i] < minpow) {
      minpow = sum[i];
      minind = i;
    }
  }
  cout << minind + 1;
  return 0;
}
