#include <bits/stdc++.h>
using namespace std;
int n, k, a[100 * 1000 + 10];
int main() {
  cin >> n >> k;
  for (long long i = (long long)1; i < (long long)n + 1; i++) {
    int x;
    scanf("%d", &x);
    if (i % k)
      a[i % k] += x;
    else
      a[k] += x;
  }
  int mn = 100010 * 1000, ind;
  for (long long i = (long long)1; i < (long long)k + 1; i++)
    if (a[i] < mn) {
      mn = a[i];
      ind = i;
    }
  cout << ind << endl;
  return 0;
}
