#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int a[100005];
  int i, j;
  int con, ans;
  int flag;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ans = 0x7fffffff;
  flag = k + 1;
  for (i = 1; i <= k; i++) {
    con = 0;
    for (j = i; j <= n; j += k) {
      con += a[j];
    }
    if (ans > con) {
      ans = con;
      flag = i;
    }
  }
  cout << flag << endl;
  return 0;
}
