#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(int argc, char* argv[]) {
  int n, k;
  cin >> n >> k;
  vector<int> mas(n);
  for (int i = 0; i < n; i++) cin >> mas[i];
  vector<int> sum(k, 0);
  for (int i = 0; i < n; i++) sum[i % k] += mas[i];
  int answer = 0;
  for (int i = 0; i < k; i++)
    if (sum[answer] > sum[i]) answer = i;
  cout << answer + 1 << endl;
  return 0;
}
