#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
using namespace std;
void fast_IO() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (long long i = 0; i < (n); ++i) cin >> (a)[i];
  ;
  vector<int> sum(k, 0);
  for (int i = 0; i < n; ++i) {
    sum[i % k] += a[i];
  }
  int m = INT_MAX, pos = 0;
  for (int i = 0; i < k; ++i) {
    if (sum[i] < m) {
      m = sum[i];
      pos = i + 1;
    }
  }
  cout << pos << "\n";
}
int main() {
  fast_IO();
  int T = 1;
  while (T--) {
    solve();
  }
}
