#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, int> > V;
int main() {
  int n, step;
  cin >> n >> step;
  vector<int> V;
  for (int k = 0; k < n; k++) {
    int x;
    cin >> x;
    V.push_back(x);
  }
  vector<int> ans;
  int mini = 100000099;
  for (int k = 0; k < step; k++) {
    int sum = 0;
    for (int i = k; i < n; i += step) sum += V[i];
    ans.push_back(sum);
    mini = min(mini, sum);
  }
  for (int k = 0; k < ans.size(); k++)
    if (ans[k] == mini) {
      cout << k + 1 << endl;
      break;
    }
  return 0;
}
