#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, j, mn = INT_MAX, in = 1, sum;
  cin >> n >> k;
  vector<long long> v(n);
  for (i = 0; i < n; i++) cin >> v[i];
  for (i = 0; i < k; i++) {
    sum = 0;
    for (j = i; j < n; j = j + k) {
      sum = sum + v[j];
    }
    if (sum < mn) {
      in = i;
      mn = sum;
    }
  }
  cout << in + 1;
}
