#include <bits/stdc++.h>
using namespace std;
long long int in[100009];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long int n, k;
  while (cin >> n >> k) {
    long long int len = n / 2, mi = INT_MAX, pos, sum = 0;
    for (int i = 1; i <= n; i++) {
      cin >> in[i];
    }
    for (int i = 1; i <= k; i++) {
      sum = 0;
      for (int j = i; j <= n; j += k) {
        sum += in[j];
      }
      if (mi > sum) {
        pos = i;
        mi = sum;
      }
    }
    cout << pos << endl;
  }
  return 0;
}
