#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ar[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &ar[i]);
  }
  int min = 1000000000;
  int rem;
  for (int i = 0; i < k; i++) {
    int sum = 0;
    for (int j = i; j < n; j += k) {
      sum += ar[j];
    }
    if (sum < min) {
      min = sum;
      rem = i + 1;
    }
  }
  cout << rem;
}
