#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, min, mini, i, j, sum;
  cin >> n >> k;
  long long a[n];
  for (i = 0; i < n; ++i) {
    cin >> a[i];
  }
  min = 999999999999999;
  for (i = 0; i < k; ++i) {
    sum = a[i];
    j = (i + k) % n;
    while (j != i) {
      sum += a[j];
      j = (j + k) % n;
    }
    if (sum < min) {
      min = sum;
      mini = i;
    }
  }
  cout << mini + 1 << endl;
  return 0;
}
