#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, i, j, k, min = (long long)pow(10, 12), x, ans = 0, sum = 0;
  cin >> n >> k;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  if (k == 1) {
    cout << 1;
    return;
  }
  i = 0;
  while (i < k) {
    j = i;
    sum = 0;
    while (j < n) {
      sum += a[j];
      j += k;
    }
    if (sum < min) {
      min = sum;
      ans = i;
    }
    i++;
  }
  cout << ans + 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t-- > 0) {
    solve();
  }
}
