#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, x = 0, y = 100000001, z = 0;
  cin >> n >> k;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    v.push_back(p);
  }
  for (int i = 0; i < k; i++) {
    x = 0;
    for (int j = i; j < n; j += k) x += v[j];
    if (x < y) {
      y = x;
      z = i;
    }
  }
  cout << z + 1 << endl;
}
