#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
int main(void) {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto &it : a) cin >> it;
  vector<int> ans(k);
  for (int i = 0; i < n; ++i) {
    ans[i % k] += a[i];
  }
  int sol = 0;
  long long mini = 1e10;
  for (int i = 0; i < k; ++i) {
    if (ans[i] < mini) {
      mini = ans[i];
      sol = i;
    }
  }
  cout << sol + 1 << endl;
}
