#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 power = 0, min_power = INT_MAX, index;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < n; j += k) {
      power += a[(i + j) % n];
    }
    if (min_power > power) {
      min_power = power;
      index = i + 1;
    }
    power = 0;
  }
  cout << index << endl;
  return 0;
}
