#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
void solve() {
  int n, k, id;
  cin >> n >> k;
  vector<int> v(n);
  long long sum = INT_MAX;
  for (int(i) = (0); (i) < (n); (i)++) cin >> v[i];
  id = 0;
  int num = n / k;
  for (int(i) = (0); (i) < (k); (i)++) {
    int j = i, cnt = 0, cur = 0;
    while (cnt < num) {
      cur += v[j % n];
      cnt++;
      j += k;
    }
    if (cur < sum) {
      id = i;
      sum = cur;
    }
  }
  cout << id + 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
  return 0;
}
