#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int l, i, k, j, n, t, s = 0, idx;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> l;
    a[i % k] += l;
  }
  int min = INT_MAX;
  for (i = 1; i < k; i++) {
    if (a[i] < min) {
      min = a[i];
      idx = i;
    }
  }
  if (a[0] < min) {
    min = a[0];
    idx = i;
  }
  cout << idx << "\n";
}
