#include <bits/stdc++.h>
using namespace std;
int a[111111], n, k;
int b[111111];
int main() {
  if (true) cin.sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < int(n); ++i) cin >> a[i], b[i % k] += a[i];
  int z = 2e9, pz = -1;
  for (int i = 0; i < int(k); ++i)
    if (b[i] < z) z = b[i], pz = i;
  cout << pz + 1 << endl;
  return 0;
}
