#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[200020];
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[n + i] = a[i];
  }
  int minx = 1e9, minid = 0;
  for (int i = 0; i < k; i++) {
    int m = 0;
    for (int j = i; j < i + n; j += k) {
      m += a[j];
    }
    if (m < minx) {
      minx = m;
      minid = i + 1;
    }
  }
  cout << minid << endl;
  return 0;
}
