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