#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1}, dy[] = {0, -1, 0, 1, -1, -1, 1, 1};
int kx[] = {2, 1, -1, -2, -2, -1, 1, 2}, ky[] = {1, 2, 2, 1, -1, -2, -2, -1};
template <class T>
T _pow(T N, T P) {
  return (P == 0) ? 1 : N * _pow(N, P - 1);
}
template <class T>
T _max(T a, T b) {
  return (!(a < b) ? a : b);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
bool isVowel(char ch) {
  ch = tolower(ch);
  return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
}
long long bigmod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (int)R;
}
long long nCr(double n, double r) {
  double ans = 1;
  if (r > n - r) r = n - r;
  for (int i = 1; i <= r; i++) {
    ans *= (n - i + 1);
    ans /= i;
  }
  return (long long)ans;
}
long long modmul(long long a, long long b, long long m) {
  return ((a % m) * (b % m)) % m;
}
string toString(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
int a[1000007];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int minsum = 2147483647, first;
  for (int i = 1; i <= k; i++) {
    int sum = 0;
    for (int j = i; j <= n; j += k) {
      sum += a[j];
    }
    if (sum < minsum) {
      minsum = sum;
      first = i;
    }
  }
  cout << first << endl;
  return 0;
}
