#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, num, min = 1000000000, pos;
  cin >> n >> k;
  int arr[k];
  for (i = 0; i < k; i++) {
    arr[i] = 0;
  }
  for (i = 0; i < n; i++) {
    cin >> num;
    arr[i % k] += num;
  }
  for (i = 0; i < k; i++) {
    if (arr[i] < min) {
      min = arr[i];
      pos = i + 1;
    }
  }
  cout << pos << endl;
  return 0;
}
