#include <bits/stdc++.h>
using std::cin;
using std::cout;
int main() {
  std::ios_base::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  std::vector<int> a(N);
  for (int& ch : a) {
    cin >> ch;
  }
  int best_sum = std::numeric_limits<int>::max();
  int best_index = 0;
  for (int start = 0; start < K; ++start) {
    int sum = 0;
    for (int i = start; i < N; i += K) {
      sum += a[i];
    }
    if (sum < best_sum) {
      best_sum = sum;
      best_index = start;
    }
  }
  cout << best_index + 1 << '\n';
  return 0;
}
