#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n, 0);
  vector<long long> sums(k, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int taskInd = (i) % k;
    sums[taskInd] += a[i];
  }
  long long ind = 1;
  long long minsum = 9999999999;
  for (long long i = 0; i < k; i++) {
    if (sums[i] < minsum) {
      minsum = sums[i];
      ind = i + 1;
    }
  }
  cout << ind << "\n";
  return 0;
}
