#include <bits/stdc++.h>
using namespace std;
int a[100500], x, n, res = int(INFINITY), k;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) {
    int q = 0;
    for (int j = i; j <= n; j += k) q += a[j];
    if (q < res) res = q, x = i;
  }
  cout << x;
  return 0;
}
