#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const long long llinf = 9223372036854775807LL;
int arr[100001];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  vector<int> v;
  v.assign(k, 0);
  for (int i = 0; i < n; i++) v[i % k] += arr[i];
  int min = v[0];
  int imin = 1;
  for (int i = 1; i < k; i++)
    if (v[i] < min) {
      imin = i + 1;
      min = v[i];
    }
  cout << imin;
  return 0;
}
