#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, w = 0, sum = -1, ind;
  int num[100009];
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> num[i];
  for (int i = 0; i < k; ++i) {
    w = 0;
    for (int j = i; j < n; j += k) {
      w += num[j];
    }
    if (w < sum || sum == -1) sum = w, ind = i;
  }
  cout << ind + 1 << endl;
  return 0;
}
