#include <bits/stdc++.h>
using namespace std;
long long n, k, i, j, a[100005];
long long pmin1 = 0, pmin2 = 1001000000, pind = 1;
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= k; i++) {
    for (j = i; j <= n; j += k) {
      pmin1 += a[j];
    }
    if (pmin2 > pmin1) pmin2 = pmin1, pind = i;
    pmin1 = 0;
  }
  cout << pind << endl;
}
