#include <bits/stdc++.h>
using namespace std;
int a[1000 * 100 + 10];
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int mx = 1000 * 1000 * 1000;
  int bt = 0;
  for (int i = 0; i < k; ++i) {
    int sm = 0;
    for (int j = i; j < n; j += k) sm += a[j];
    if (sm < mx) mx = sm, bt = i + 1;
  }
  cout << bt << endl;
  return 0;
}
