#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n + 5], sum = 0, res = INT_MAX, pos;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) {
    sum = 0;
    for (int j = i; j <= n; j = j + k) sum = sum + a[j];
    if (sum < res) {
      res = sum;
      pos = i;
    }
  }
  cout << pos << endl;
  return 0;
}
