#include <bits/stdc++.h>
using namespace std;
const int maxn = 10001;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int a[k];
  for (int i = 0; i < k; i++) {
    a[i] = 0;
  }
  for (int i = 0; i < n; i++) a[i % k] += arr[i];
  int in = -1;
  int mn = INT_MAX;
  for (int i = 0; i < k; i++) {
    if (mn > a[i]) {
      in = i + 1;
      mn = a[i];
    }
  }
  cout << in;
  return 0;
}
