#include <bits/stdc++.h>
using namespace std;
int a[100100];
int n, k;
void init() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
}
void solve() {
  int startPos = -1;
  int bestAns = 1000000000 + 1;
  int currAns;
  for (int i = 1; i <= k; i++) {
    currAns = 0;
    for (int j = i; j <= n; j += k) currAns += a[j];
    if (currAns < bestAns) {
      bestAns = currAns;
      startPos = i;
    }
  }
  cout << startPos << endl;
}
int main() {
  cin.sync_with_stdio(0);
  int numberOfTests = 1;
  for (int i = 1; i <= numberOfTests; i++) {
    init();
    solve();
  }
  return 0;
}
