#include <bits/stdc++.h>
using namespace std;
const int inf = 0;
const double eps = 0;
const int ms = 0;
const int md = 0;
const int MAX_N = 1e5 + 5;
const int MAX_L = 20;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;
int main() {
  long long n, d;
  cin >> n >> d;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<long long> cnt(d, 0);
  for (int i = 0; i < d; i++) {
    for (int j = i; j < n; j += d) {
      cnt[i] += arr[j];
    }
  }
  long long ans = INF, ansI = 0;
  for (int i = 0; i < d; i++) {
    if (ans > cnt[i]) {
      ans = cnt[i];
      ansI = i;
    }
  }
  cout << ansI + 1 << endl;
  return 0;
}
