#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  int frac = n / k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int ans = 0;
  int min_sum = INT_MAX;
  for (int i = 0; i < k; i++) {
    int l = i;
    int sum = 0;
    for (int j = 0; j < frac; j++) {
      sum += arr[l];
      l = l + k;
    }
    if (min_sum > sum) {
      ans = i;
      min_sum = sum;
    }
  }
  cout << ans + 1;
}
