#include <bits/stdc++.h>
using namespace std;
int powers[100002];
int main() {
  map<int, set<long long> > indices;
  int n, k, index, beg = 1;
  long long min_first = 0, min_second = 0;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> powers[i];
  int start = beg;
  while (!(start > n)) {
    min_first += powers[start];
    start += k;
  }
  indices[min_first].insert(beg);
  beg++;
  while (!(beg > k + 1)) {
    min_second = 0;
    start = beg;
    while (!(start > n)) {
      min_second += powers[start];
      start += k;
    }
    start = start - n;
    while (start < beg) {
      min_second += powers[start];
      start += k;
    }
    if (min_second < min_first) {
      min_first = min_second;
      indices[min_first].insert(beg);
    }
    if (min_second == min_first) {
      indices[min_first].insert(beg);
    }
    beg++;
  }
  cout << *(indices.begin()->second.begin()) << endl;
  return 0;
}
