#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<int> d(k);
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < n / k; ++j) {
      d[i] += a[(i + j * k) % n];
    }
  }
  int min_pos = min_element(d.begin(), d.end()) - d.begin() + 1;
  cout << min_pos << endl;
  return 0;
}
