#include <bits/stdc++.h>
using namespace std;
int a[111111], x, y, w, z, n, maxn = 999999999, k;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  if (n < k) {
    cout << 1;
    return 0;
  }
  for (int i = 1; i <= k; i++) {
    int sum = 0;
    for (int j = i; j <= n; j += k) {
      sum += a[j];
    }
    if (sum < maxn) {
      maxn = sum;
      x = i;
    }
  }
  cout << x;
  return 0;
}
