#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n), B(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    if (i < k)
      B[i] = A[i];
    else
      B[i] = A[i] + B[i - k];
  }
  int min = INT_MAX, index = 0;
  for (int i = n - k; i < n; i++) {
    if (B[i] < min) {
      min = B[i];
      index = i + 1 - (n - k);
    }
  }
  cout << index << "\n";
  return 0;
}
