#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
const int mod = 1e9 + 7;
template <class T>
inline void readInt(T &n) {
  n = 0;
  T ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  n = n * sign;
}
unsigned long long arr[100001];
int main() {
  unsigned long long n, k, minp = 10;
  cin >> n >> k;
  for (int i = ((int)(0)); i < ((int)(n)); i++) {
    readInt(arr[i]);
    minp += arr[i];
  };
  int ans;
  for (int i = ((int)(0)); i < ((int)(k)); i++) {
    unsigned long long po = 0;
    unsigned long long r = i;
    while (r < n) {
      po += arr[r];
      r += k;
    }
    if (po < minp) {
      minp = po;
      ans = i + 1;
    }
  }
  cout << ans << endl;
}
