#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, K;
  cin >> N >> K;
  vector<int> prices(K, 0);
  for (int n = 0; n < N; ++n) {
    int x;
    cin >> x;
    prices[n % K] += x;
  }
  int min = prices[0], mink = 0;
  for (int k = 1; k < K; ++k) {
    if (prices[k] < min) {
      min = prices[k];
      mink = k;
    }
  }
  cout << (mink + 1) << endl;
  return 0;
}
