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