#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int minsum = INT_MAX, mini = n + 1, curr, count = 0;
  for (int i = 0; i < k; i++) {
    curr = 0;
    count = 0;
    for (int j = i; count < n / k; j += (k % n)) {
      curr += a[j];
      count++;
    }
    if (curr < minsum) {
      minsum = curr;
      mini = i + 1;
    }
  }
  cout << mini << endl;
  return 0;
}
