#include <bits/stdc++.h>
using namespace std;
int main() {
  long long c = 0, min = INT_MAX;
  int n, k, ans;
  cin >> n >> k;
  int a[n], m = INT_MAX, in, sum[k + 1];
  memset(sum, 0, sizeof(sum));
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum[i % k] += a[i];
  }
  for (int i = 0; i < k; i++) {
    if (sum[i] < min) {
      min = sum[i];
      ans = i + 1;
    }
  }
  cout << ans;
  return 0;
}
