#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const int maxn = 100005;
int f[maxn];
int main() {
  int n, k, ans = -1, Min = inf;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> f[i];
  for (int i = 1; i <= k; ++i) {
    int s = 0;
    for (int j = i; j <= n; j += k) s += f[j];
    if (s < Min) ans = i, Min = s;
  }
  cout << ans << endl;
  return 0;
}
