#include <bits/stdc++.h>
using namespace std;
const int N = 1e9 + 1;
const long double pi = 3.1415926535897;
void solve() {
  int n, k;
  cin >> n >> k;
  long long x, s[k];
  memset(s, 0, sizeof(s));
  for (int i = 0; i < n; i++) {
    cin >> x;
    s[i % k] += x;
  }
  long long mini = 10000000001, minpos;
  for (int i = 0; i < k; i++)
    if (s[i] < mini) {
      mini = s[i];
      minpos = i;
    }
  cout << minpos + 1;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
