#include <bits/stdc++.h>
using namespace std;
long long n, q, k, s[200010], bst, bp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> q;
    s[i % k] += q;
  }
  bst = 1e9;
  bp = 0;
  for (int i = 0; i < k; i++)
    if (s[i] < bst) bst = s[i], bp = i;
  cout << bp + 1 << "\n";
  return 0;
}
