#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, x;
  vector<int> a;
  cin >> n >> k;
  vector<int> w(k);
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  for (int i = 0; i < k; i++) {
    for (int j = i; j < n; j += k) {
      w[i] += a[j];
    }
  }
  int menor = w[0];
  int z = 0;
  for (int i = 0; i < k; i++)
    if (menor > w[i]) {
      menor = w[i];
      z = i;
    }
  cout << z + 1 << endl;
}
