#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
int main() {
  long long n, k;
  long long power[100005];
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> power[i];
  }
  long long sum[10000];
  memset(sum, 0, sizeof(sum));
  for (long long i = 1; i <= k; i++) {
    for (long long j = i; j <= n; j = j + k) {
      sum[i] += power[j];
    }
  }
  long long ans;
  long long min = sum[1];
  ans = 1;
  for (long long i = 1; i <= k; i++) {
    if (min > sum[i]) {
      min = sum[i];
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
