#include <bits/stdc++.h>
using namespace std;
int main() {
  int dela;
  cin >> dela;
  int prom;
  cin >> prom;
  int zlost[100000];
  int kills[100000];
  for (int i = 0; i < 100000; i++) {
    zlost[i] = 0;
    kills[i] = 0;
  }
  for (int i = 0; i < dela; i++) {
    cin >> zlost[i];
  }
  int t = 0;
  for (int i = 0; i < prom; i++) {
    for (int j = t; j < dela; j = j + prom) {
      kills[i] += zlost[j];
    }
    t++;
  }
  int lev = 2000000000;
  int k;
  for (int i = 0; i < prom; i++) {
    if (kills[i] < lev) {
      lev = kills[i];
      k = i;
    }
  }
  cout << k + 1;
}
