#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  vector<int> vi;
  int temp;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    vi.push_back(temp);
  }
  int ans = 99999999;
  int pos;
  for (int i = 0; i < k; i++) {
    temp = 0;
    for (int j = i; j < n; j += k) {
      temp += vi[j];
    }
    if (temp < ans) {
      ans = temp;
      pos = i;
    }
  }
  cout << pos + 1 << endl;
  return 0;
}
