#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q = 1;
  while (q--) {
    long long n, k;
    cin >> n >> k;
    long long a[n], s[k];
    for (long long i = 0; i < n; i++) cin >> a[i];
    for (long long i = 0; i < k; i++) s[i] = 0;
    long long j = 0;
    for (long long i = 0; i < n; i++) {
      s[j] += a[i];
      j = (j + 1) % k;
    }
    long long m = INT_MAX, mi = -1;
    for (long long i = 0; i < k; i++)
      if (s[i] < m) {
        m = s[i];
        mi = i;
      }
    cout << mi + 1;
  }
  return 0;
}
