#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const int MAX = 100010;
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int mn = INF, mnidx;
  for (int i = 0; i < k; i++) {
    int idx, res = 0;
    for (idx = i; idx < n; idx += k) res += v[idx];
    if (res < mn) {
      mn = res;
      mnidx = i;
    }
  }
  cout << mnidx + 1 << endl;
  return 0;
}
