#include <bits/stdc++.h>
using namespace std;
long long N = 1e8 + 3;
const int sz = 2e5;
long long n, x, i, j, arr[sz], k, ans = 1;
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> arr[i];
  for (i = 1; i <= n; i++) {
    long long sum = 0;
    if (arr[i])
      for (j = i; j <= n; j += k) {
        sum += arr[j];
        arr[j] = 0;
      }
    if (N > sum && sum) N = sum, ans = i;
  }
  cout << ans;
  return 0;
}
