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