#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k, arr[100010];
  cin >> n >> k;
  for (int i = 0; i < (int)(n); ++i) cin >> arr[i];
  int bst = oo, bstIdx = 0;
  for (int i = 0; i < (int)(k); ++i) {
    int cur = 0;
    for (int j = i; j < n; j += k) {
      cur += arr[j];
    }
    if (cur < bst) {
      bst = cur;
      bstIdx = i;
    }
  }
  cout << bstIdx + 1 << endl;
  return 0;
}
