#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const int mod = 1e9 + 7;
const int MAXX = 1e6 + 5;
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int a[n];
  long long int sum[k];
  long long int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < k; i++) {
    sum[i] = 0;
  }
  for (i = 0; i < n; i++) {
    sum[i % k] += a[i];
  }
  long long int min = 0, index = 0;
  for (i = 0; i < k; i++) {
    if (sum[i] < sum[min]) {
      min = i;
    }
  }
  cout << min + 1;
  return 0;
}
void findDivisors(int n) {
  int div[N];
  memset(div, 0, sizeof div);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j * i <= n; j++) div[i * j]++;
  }
}
void sieve(int n) {
  vector<int> primes;
  bool iscomp[N];
  for (int i = 2; i <= n; ++i) {
    if (!iscomp[i]) primes.push_back(i);
    for (int j = 0; j < primes.size() && i * primes[j] <= n; ++j) {
      iscomp[i * primes[j]] = true;
      if (i % primes[j] == 0) break;
    }
  }
}
int mpow(int base, int exp, int md = mod) {
  int result = 1;
  base %= md;
  if (base == 0) return 0;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % md;
    base = (base * base) % md;
    exp >>= 1;
  }
  return result;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
int ncr(int n, int r) {
  vector<int> fac(N), inv(N);
  return fac[n] * (inv[r] * inv[n - r] % mod) % mod;
  return fac[n] * (mpow(fac[r], mod - 2) * mpow(fac[n - r], mod - 2) % mod) %
         mod;
}
int highestPowerOf2(int n) { return (n & (~(n - 1))); }
int count_digit(int number) { return int32_t(log10(number) + 1); }
int sum_digit(int n) {
  int sum = 0;
  while (n != 0) {
    sum = sum + n % 10;
    n = n / 10;
  }
  return sum;
}
int sum_digit(string str) {
  int sum = 0;
  for (int i = 0; i < str.length(); i++) {
    sum = sum + str[i] - 48;
  }
  return sum;
}
string dec2bin(int n) {
  const int size = sizeof(n) * 8;
  string s = "00000000000000000000000000000000";
  for (int a = 0; a < 32; a++) {
    if (n == 0)
      return s;
    else {
      if (n % 2 != 0) s[31 - a] = '1';
      n /= 2;
    }
  }
  return s;
}
