#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n;
  cin >> n >> k;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int r = n / k;
  int i = 1;
  int min = numeric_limits<int>::max();
  int sum = 0, p;
  while (i + k * (r - 1) <= n) {
    sum = 0;
    for (int j = 0; j < r; j++) {
      sum += a[i + k * j];
    }
    if (sum < min) {
      min = sum;
      p = i;
    }
    i++;
  }
  cout << p << endl;
  return 0;
}
