#include <bits/stdc++.h>
using namespace std;
int arr[100005], x, i, j, k, an, anss, n;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  an = 1e9;
  for (int i = 0; i < k; i++) {
    x = 0;
    j = i + k, x += arr[i];
    while (j % n != i) x += arr[j % n], j += k;
    if (x < an) anss = i + 1, an = x;
  }
  cout << anss << endl;
}
