#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
const int inf = 1e9 + 1;
int a[N];
int b[N];
int mast = INT_MAX;
int ptr;
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i % k] += a[i];
  }
  for (int i = 0; i < k; i++) {
    if (b[i] < mast) {
      mast = b[i];
      ptr = i;
    }
  }
  cout << ptr + 1 << endl;
  return 0;
}
