#include <bits/stdc++.h>
using namespace std;
long long i, n, r, s, j, a, b, c, t, A[200001], mn = 10000000000, l, k;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> A[i];
  for (i = 1; i <= k; i++) {
    s = 0;
    for (j = i; j <= n; j = j + k) s = s + A[j];
    if (j % n < k) s = s + A[j];
    if (mn > s) {
      mn = s;
      l = i;
    }
  }
  cout << l;
}
