#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
void solve() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int minPower = INT_MAX;
  int index = 0;
  for (int i = 0; i < k; i++) {
    int power = a[i];
    for (int j = (i + k) % n; j < n;) {
      if (j == i) break;
      power += a[j];
      j = (j + k) % n;
    }
    if (minPower > power) {
      minPower = power;
      index = i;
    }
  }
  cout << index + 1 << endl;
}
