#include <bits/stdc++.h>
using namespace std;
long a[100000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long n, k;
  cin >> n >> k;
  for (long i = 0; i < n; i++) cin >> a[i];
  long mini = LONG_MAX, miniInd = 0, sum;
  for (long i = 0; i < k; i++) {
    long j = i;
    sum = a[j];
    j += k;
    if (j >= n) j = j - n;
    while (j != i) {
      sum += a[j];
      j += k;
      if (j >= n) j = j - n;
    }
    if (sum < mini) {
      mini = sum;
      miniInd = i;
    }
  }
  cout << miniInd + 1;
  return 0;
}
