You helped Dima to have a great weekend, but it's time to work. Naturally, Dima, as all other men who have girlfriends, does everything wrong.

Inna and Dima are now in one room. Inna tells Dima off for everything he does in her presence. After Inna tells him off for something, she goes to another room, walks there in circles muttering about how useless her sweetheart is. During that time Dima has time to peacefully complete k - 1 tasks. Then Inna returns and tells Dima off for the next task he does in her presence and goes to another room again. It continues until Dima is through with his tasks.

Overall, Dima has n tasks to do, each task has a unique number from 1 to n. Dima loves order, so he does tasks consecutively, starting from some task. For example, if Dima has 6 tasks to do in total, then, if he starts from the 5-th task, the order is like that: first Dima does the 5-th task, then the 6-th one, then the 1-st one, then the 2-nd one, then the 3-rd one, then the 4-th one.

Inna tells Dima off (only lovingly and appropriately!) so often and systematically that he's very well learned the power with which she tells him off for each task. Help Dima choose the first task so that in total he gets told off with as little power as possible.


-----Input-----

The first line of the input contains two integers n, k (1 ≤ k ≤ n ≤ 10^5). The second line contains n integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^3), where a_{i} is the power Inna tells Dima off with if she is present in the room while he is doing the i-th task.

It is guaranteed that n is divisible by k.


-----Output-----

In a single line print the number of the task Dima should start with to get told off with as little power as possible. If there are multiple solutions, print the one with the minimum number of the first task to do.


-----Examples-----
Input
6 2
3 2 1 6 5 4

Output
1

Input
10 5
1 3 5 7 9 9 4 1 8 5

Output
3



-----Note-----

Explanation of the first example.

If Dima starts from the first task, Inna tells him off with power 3, then Dima can do one more task (as k = 2), then Inna tells him off for the third task with power 1, then she tells him off for the fifth task with power 5. Thus, Dima gets told off with total power 3 + 1 + 5 = 9. If Dima started from the second task, for example, then Inna would tell him off for tasks 2, 4 and 6 with power 2 + 6 + 4 = 12. 

Explanation of the second example.

In the second example k = 5, thus, Dima manages to complete 4 tasks in-between the telling off sessions. Thus, Inna tells Dima off for tasks number 1 and 6 (if he starts from 1 or 6), 2 and 7 (if he starts from 2 or 7) and so on. The optimal answer is to start from task 3 or 8, 3 has a smaller number, so the answer is 3.

Difficulty: EASY

Solutions:
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
min1 = 100000000000
c = 0
for i in range(k):
	sum1 = sum(arr[i::k])
	if sum1 < min1:
		c = i
		min1 = sum1
print(c + 1)


(n, k) = map(int, input().split())
t = list(map(int, input().split()))
print(min(((sum(t[i::k]), i) for i in range(k)))[1] + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().strip().split()))[:n]
b = []
for i in range(k):
	b.append(0)
for i in range(n):
	b[i % k] += a[i]
c = b.index(min(b))
print(c + 1)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
(n, k) = rinput()
a = get_list()
ans = []
for i in range(k):
	l = a[i::k]
	ans.append([i + 1, sum(l)])
ans.sort(key=lambda x: x[1])
print(ans[0][0])


(_, k) = map(int, input().split())
(v, s) = (map(int, input().split()), [0] * k)
for (i, x) in enumerate(v):
	s[i % k] += x
print(min([(x, i) for (i, x) in enumerate(s)])[1] + 1)


def main():
	(n, k) = map(int, input().split())
	aa = list(map(int, input().split()))
	res = [sum(aa[i::k]) for i in range(k)]
	print(min(range(k), key=res.__getitem__) + 1)
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 10 ** 9
bestI = 0
for i in range(k):
	score = 0
	r = n // k
	while r > 0:
		score += a[i]
		i += k
		if i >= n:
			i -= n
		r -= 1
	if score < ans:
		ans = score
		bestI = i + 1
print(bestI)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
xx = [0 for _ in range(k)]
for i in range(n):
	xx[i % k] += a[i]
print(xx.index(min(xx)) + 1)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = []
for i in range(k):
	f = i
	res = 0
	for j in range(i, i + n, k):
		res += l[j]
	ans.append([f, res])
ans = sorted(ans, key=lambda x: x[1])
final = ans[0][0]
print(final + 1)


(n, k) = map(int, input().split())
list1 = list(map(int, input().split()))
x = 0
xx = 100000001
index = 0
for i in range(k):
	s = 0
	for j in range(x, n, k):
		s += list1[j]
	if s < xx:
		xx = s
		index = x
	x += 1
print(index + 1)


(n, k) = map(int, input().split())
list = list(map(int, input().split()))
ans = None
index = 1
for i in range(0, k):
	sum = 0
	for j in range(i, n + i, k):
		sum += list[j % n]
	if ans is None or ans > sum:
		ans = sum
		index = i + 1
print(index)


(n, k) = map(int, input().split())
l = [0] * k
ind = 0
for i in input().split():
	l[ind % k] += int(i)
	ind += 1
print(l.index(min(l)) + 1)


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
p = n // k
ans = 100000000000
index = 0
for i in range(k):
	suma = 0
	for j in range(p):
		suma += L[i + j * k]
	if suma < ans:
		ans = suma
		index = i
print(index + 1)


def todo_list(end, k, arr):
	count = 0
	start = 0
	result = 100000 * 1000000
	while count != k:
		b = 0
		for x in range(start, end, k):
			b += arr[x]
		if b < result:
			result = b
			ans = start + 1
		start += 1
		count += 1
	return ans
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
print(todo_list(n, k, arr))


import math
import sys
(n, m) = map(int, input().split())
d = list(map(int, input().split()))
p = 0
r = 10 ** 8 + 1
for i in range(m):
	tp = i
	tm = 0
	while tp < n:
		tm += d[tp]
		tp += m
	if r > tm:
		r = tm
		p = i
print(p + 1)


(n, k) = (int(x) for x in input().split())
s = input()
deals = [int(x) for x in s.split()]
punish = [0 for x in range(k)]
for i in range(n):
	punish[i % k] += deals[i]
print(punish.index(min(punish)) + 1)


def main():
	(n, k) = map(int, input().split())
	a = [int(c) for c in input().split()]
	mx = 1000 * n
	idx = 1
	for i in range(k):
		res = 0
		j = i
		for j in range(i, i + n, k):
			res += a[j % n]
		if res < mx:
			mx = res
			idx = i + 1
	print(idx)
main()


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, k) = iia()
arr = iia()
num = [0] * k
for i in range(n):
	num[i % k] += arr[i]
ans = num.index(min(num)) + 1
print(ans)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import *
from itertools import accumulate
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
en = lambda x: list(enumerate(x))
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(n, k) = r()
arr = rr()
x = inf
ans = [0] * k
for (i, j) in en(arr):
	ans[i % k] += j
print(ans.index(min(ans)) + 1)


[n, k] = [int(x) for x in input().split(' ')]
A = [int(x) for x in input().split(' ')]
m = -1
valm = 10 ** 10
for i in range(k):
	temp = sum([A[(k * j + i) % n] for j in range(n // k)])
	if temp < valm:
		valm = temp
		m = i
print(m + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
pergroup = n // k
b = [0] * k
(i, j) = (0, 0)
while i < n:
	b[j] += a[i]
	j = (j + 1) % k
	i += 1
mintime = min(b)
for i in range(len(b)):
	if b[i] == mintime:
		break
print(i + 1)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
(n, k) = rinput()
A = rlinput()
ans = []
index = 0
for i in range(k):
	cur = 0
	for j in range(i, n, k):
		cur += A[j]
	ans.append(cur)
	if i == 0:
		min = cur
		index = 1
	elif cur < min:
		min = cur
		index = i + 1
print(index)


class CodeforcesTask366BSolution:

	def __init__(self):
		self.result = ''
		self.n_k = []
		self.tells = []

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]
		self.tells = [int(x) for x in input().split(' ')]

	def process_task(self):
		telling = [0] * self.n_k[1]
		for x in range(self.n_k[0]):
			telling[x % self.n_k[1]] += self.tells[x]
		self.result = str(telling.index(min(telling)) + 1)

	def get_result(self):
		return self.result
Solution = CodeforcesTask366BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, m) = input().split(' ')
n = int(n)
m = int(m)
arr = list()
arr = list(map(int, input().split()))
for i in range(n):
	arr.append(arr[i])
d = [None] * 2 * n
mn = 10000000000000000
j = 0
for i in range(2 * n):
	if i - m >= 0:
		d[i] = d[i - m] + arr[i]
	else:
		d[i] = arr[i]
	if i >= n:
		if mn > d[i] - d[i - n]:
			mn = d[i] - d[i - n]
			j = i - n
print(j + 1)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
ans = []
for i in range(k):
	sum = arr[i]
	l = (i + k) % n
	while i != l:
		sum += arr[l]
		l = (l + k) % n
	ans.append(sum)
min = max(ans)
min_indx = 0
for i in range(k):
	if ans[i] < min:
		min = ans[i]
		min_indx = i
print(min_indx + 1)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
(n, k) = L()
A = L()
d = [0 for i in range(k)]
for i in range(n):
	d[i % k] += A[i]
x = d.index(min(d))
print(x + 1)
endtime = time.time()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
start_job = 1
min_hate = 1000 * n + 1
for i in range(k):
	hate = sum(a[i::k])
	if hate < min_hate:
		start_job = i + 1
		min_hate = hate
print(start_job)


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	(n, k) = lst()
	a = lst()
	sm = [0] * k
	for i in range(n):
		sm[i % k] += a[i]
	p = 0
	for i in range(k):
		if sm[i] < sm[p]:
			p = i
	print(p + 1)


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())

def solve(n, k, arr):
	out = [0] * k
	for i in range(n):
		out[i % k] += arr[i]
	print(out.index(min(out)) + 1)
(n, k) = get_int()
arr = int_arr()
solve(n, k, arr)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ind = [x for x in range(0, n, k)]
m = 100000000.0
mi = 0
for i in range(0, k):
	x = sum((a[i + j] for j in ind))
	if x < m:
		m = x
		mi = i
print(mi + 1)


(n, k) = list(map(int, input().split()))
arr = [int(x) for x in input().split(' ')]
num = 10000000000
for i in range(0, k):
	sum = 0
	for j in range(0, int(n / k)):
		sum += arr[j * k + i]
	if sum < num:
		num = sum
		ans = i + 1
print(str(ans))


def read():
	(n, k) = list(map(int, input().split()))
	powers = list(map(int, input().split()))
	return (n, k, powers)

def get_min_power(n, k, powers):
	start_task = 0
	mins = []
	for i in range(k):
		s = 0
		for j in range(i, n, k):
			s += powers[j]
		mins.append(s)
	task = min(mins)
	return mins.index(task) + 1

def main():
	(n, k, powers) = read()
	print(get_min_power(n, k, powers))

def __starting_point():
	main()
__starting_point()


R = lambda : map(int, input().split())
(n, k) = R()
s = list(R())
a = 0
b = float('inf')
for i in range(k):
	c = sum(s[i::k])
	if c < b:
		a = i + 1
		b = c
print(a)


def mi():
	return map(int, input().split())
(n, k) = mi()
a = list(mi())
dp = [0] * k
for i in range(k):
	for j in range(i, n, k):
		dp[i] += a[j]
print(1 + dp.index(min(dp)))


from sys import *
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
(n, k) = get_int()
arr = int_arr()
res = [0] * k
for i in range(n):
	res[i % k] += arr[i]
print(res.index(min(res)) + 1)


(n, k) = map(int, input().split())
xs = list(map(int, input().split()))
res = (10 ** 9, -1)
for i in range(k):
	s = 0
	for j in range(i, n, k):
		s += xs[j]
	res = min(res, (s, i + 1))
print(res[1])


(n, k) = map(int, input().split())
l = [int(x) for x in input().split()]
ans = []
minn = 123456567
key = 0
for i in range(k):
	j = i
	summ = 0
	while j < n:
		summ += l[j]
		j += k
	if summ < minn:
		minn = summ
		key = i
print(key + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split())) * 2
for i in range(n + n - k - 1, -1, -1):
	a[i] += a[i + k]
(mi, mm) = (0, float('inf'))
for i in range(n):
	x = a[i] - a[i + n]
	if mm > x:
		mi = i
		mm = x
print(mi + 1)


from functools import reduce
(n, k) = list(map(int, input().split(' ')))
nums = list(map(int, input().split(' ')))
res = []
for i in range(k):
	sum = 0
	for j in range(int(n / k)):
		sum += nums[i + j * k]
	res.append(sum)
print(res.index(min(res)) + 1)


__author__ = 'Lipen'

def actions(n, k, a):
	smin = -1
	answer = 1
	for i in range(k):
		s = sum(a[i::k])
		if s < smin or smin == -1:
			smin = s
			answer = i + 1
	return answer

def main():
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	print(actions(n, k, a))
main()


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input().split()))
(n, k) = I()
a = I()
b = a + a
min_index = 0
min_sum = sum(a) + 1
for i in range(k):
	j = i
	sum1 = 0
	while j < n:
		sum1 = sum1 + a[j]
		j = j + k
	if sum1 < min_sum:
		min_index = i + 1
		min_sum = sum1
print(min_index)


(n, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
L = []
for i in range(k):
	s = 0
	for j in range(i, n, k):
		s += A[j]
	L.append(s)
x = min(L)
print(L.index(x) + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 10 ** 9
sol = -1
for i in range(k):
	x = n // k
	y = i
	tmp = 0
	while x:
		tmp += a[y]
		y += k
		y %= n
		x -= 1
	if tmp < ans:
		ans = tmp
		sol = i + 1
print(sol)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
hash = {}
for i in range(n):
	try:
		hash[i % k]
	except:
		hash[i % k] = [0, i]
		hash[i % k][0] += l[i]
	else:
		hash[i % k][0] += l[i]
min = 10 ** 10
for i in hash.keys():
	if hash[i][0] < min:
		min = hash[i][0]
		ans = hash[i][1]
print(ans + 1)


(n, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
ms = sum(A) + 1
ind = 0
for i in range(k):
	cs = sum(A[i::k])
	if ms > cs:
		ms = cs
		ind = i + 1
print(ind)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
a = 0
m = 9099909009909
for i in range(k):
	c = sum(l[i::k])
	if m > c:
		m = c
		a = i + 1
print(a)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
ans = 0
mini = sum(c)
for i in range(b):
	d = i
	su = 0
	while d < a:
		su += c[d]
		d += b
	if su < mini:
		mini = su
		ans = i
print(ans + 1)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
t = {}
for (i, e) in enumerate(m):
	if i % k not in t:
		t[i % k] = e
	else:
		t[i % k] += e
mi = t[0]
mai = 1
for i in t:
	if mi > t[i]:
		mi = t[i]
		mai = i + 1
print(mai)


(n, k) = list(map(int, input().split()))
powers = list(map(int, input().split())) * 2
ans = float('inf')
pointer = 0
for i in range(k):
	rem = i % k
	temp = sum(powers[rem::k])
	if temp < ans:
		ans = temp
		pointer = i + 1
print(pointer)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
B = A + A
time = []
for i in range(k):
	a = i
	summ = 0
	for j in range(n // k):
		summ += B[a]
		a += k
	time.append([summ, i + 1])
time.sort()
print(time[0][1])


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
ans = float('inf')
x = -1
for i in range(0, k):
	t = a[i]
	j = i + k
	while j < n:
		t += a[j]
		j += k
	if t < ans:
		ans = t
		x = i + 1
print(x)


(n, k) = list(map(int, input().split()))
num = list(map(int, input().split()))
dp = [0] * (2 * n)
for i in range(n - 1, -1, -1):
	dp[i] = dp[i + k] + num[i]
ans = 2 ** 100
for i in range(0, k):
	ans = min(ans, dp[i])
print(dp.index(ans) + 1)


data = input().split(' ')
tasks = int(data[0])
k = int(data[1])
cost = input().split(' ')
cost = [int(x) for x in cost]
minCost = sum(cost)
ans = 1
for i in range(k):
	start = i
	c = 0
	for j in range(start, tasks, k):
		c += cost[j]
	if c < minCost:
		minCost = c
		ans = i + 1
print(ans)


(n, k) = map(int, input().split())
t = list(map(int, input().split()))
current_sum = None
flag = 1
for i in range(k):
	if current_sum == None or sum(t[i::k]) < current_sum:
		current_sum = sum(t[i::k])
		flag = i + 1
print(flag)


import sys
import bisect
import heapq
from math import *
from collections import defaultdict as dd
from collections import deque
from collections import Counter as c
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(var)

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]
(n, k) = sp()
arr = l()
answer = None
dp = dd(int)
for i in range(n):
	dp[i % k] += arr[i]
for i in range(k):
	if answer is None:
		answer = i
		continue
	if dp[i] < dp[answer]:
		answer = i
		continue
out(str(answer + 1))


def main():
	from sys import stdin, stdout
	(n, k) = map(int, stdin.readline().split())
	arr = tuple(map(int, stdin.readline().split()))
	minim = 0
	for i in range(1, k):
		if sum(arr[i::k]) < sum(arr[minim::k]):
			minim = i
	stdout.write(str(minim + 1))
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
dp = [0] * k
for i in range(n):
	m = i % k
	dp[m] += a[i]
g = 1000000000
l = 0
for i in range(k):
	if g > dp[i]:
		g = dp[i]
		l = i
print(l + 1)


def inp(n):
	if n == 1:
		return map(int, stdin.readline().split())
	elif n == 2:
		return map(float, stdin.readline().split())
	else:
		return map(str, stdin.readline().split())

def arr_inp():
	return [int(x) for x in stdin.readline().split()]

def sum_arr(ix):
	if ix < k:
		mem[ix] = n // k * sum(a[ix::k])
		return mem[ix]
	else:
		return mem[ix % k]
from sys import stdin
from collections import defaultdict
(n, k) = inp(1)
(a, mi, ans, mem) = (arr_inp(), float('inf'), 1, defaultdict(int))
for i in range(n):
	new = sum_arr(i)
	if new < mi:
		(mi, ans) = (new, i + 1)
print(ans)


def start():
	(n, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	ssum = []
	for i in range(k):
		xsum = 0
		for j in range(i, n, k):
			xsum += l[j]
		ssum.append(xsum)
	print(ssum.index(min(ssum)) + 1)
tc = 1
while tc:
	start()
	tc = tc - 1


(n, k) = map(int, input().split())
arr = [0]
arr += list(map(int, input().split()))
for i in range(k, n + 1):
	arr[i] += arr[i - k]
ans = n
m = 10 ** 9
for i in range(n, n - k, -1):
	if arr[i] <= m:
		m = arr[i]
		ans = i
ans %= k
if ans == 0:
	ans = k
print(ans)


import sys
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
r = [0] * k
for i in range(n):
	r[i % k] = r[i % k] + a[i]
b = min(r)
print(r.index(b) + 1)


import sys
inf = float('inf')

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, k) = get_ints()
Arr = get_array()
z = n // k
mini = inf
index = 0
for i in range(k):
	z = sum(Arr[i:n:k])
	if z < mini:
		mini = z
		index = i
print(index + 1)


(n, m) = input().split()
n = int(n)
m = int(m)
arr = [int(x) for x in input().split()]
min = 1000000000000
ans = -1
for i in range(m):
	sum = 0
	for j in range(i, n, m):
		sum = sum + arr[j]
	if sum < min:
		min = sum
		ans = i
print(ans + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = 1000000000
ans = 1
for i in range(k):
	mt = 0
	for j in range(i, n, k):
		mt += a[j]
	if mt < m:
		m = mt
		ans = i + 1
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = [0 for i in range(k)]
for i in range(len(a)):
	s[i % k] += a[i]
j = 0
for i in range(k):
	if s[i] < s[j]:
		j = i
print(j + 1)


from functools import reduce
from operator import *
from math import *
from sys import *
from string import *
from collections import *
setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda : list(map(int, input().split()))
RS = lambda : input().rstrip().split()
(n, k) = RI()
v = [0] * k
a = RI()
for i in range(n):
	v[i % k] += a[i]
minInd = 0
for i in range(k):
	if v[i] < v[minInd]:
		minInd = i
print(minInd + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
min = 1000000000
ind = 0
for i in range(k):
	sum = 0
	for j in range(0, n, k):
		sum += a[(i + j) % n]
	if sum < min:
		min = sum
		ind = i + 1
print(ind)


import math

def ni():
	return int(input())

def vals():
	return list(map(int, input().split()))

def nextLine():
	return input()
(n, k) = vals()
a = vals()
cnt = [0 for i in range(k)]
for i in range(n):
	cnt[i % k] += a[i]
choice = -1
mx = int(1e+18)
for i in range(k):
	if cnt[i] < mx:
		choice = i + 1
		mx = cnt[i]
print(choice)


import sys, threading, os.path
import collections, heapq, math, bisect
import string
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)

def main():
	if os.path.exists('in.txt'):
		input = open('in.txt', 'r')
	else:
		input = sys.stdin
	(n, k) = list(map(int, input.readline().split()))
	lis = list(map(int, input.readline().split()))
	lis1 = [0 for i in range(k)]
	case1 = n / k
	(ans1, ans2) = (10000000, 0)
	for (i, x) in enumerate(lis):
		lis1[i % k] += lis[i]
	ans1 = min(lis1)
	for (i, x) in enumerate(lis1):
		if x == ans1:
			ans2 = i + 1
			break
	output = ans2
	if os.path.exists('out.txt'):
		open('out.txt', 'w').writelines(str(output))
	else:
		sys.stdout.write(str(output))

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
min1 = 1000000000000000
ans = 1
for i in range(k):
	sum1 = 0
	j = i
	while j < n:
		sum1 += li[j]
		j += k
	if sum1 < min1:
		ans = i + 1
		min1 = sum1
print(ans)


(n, k) = map(int, input().split())
work = list(map(int, input().split()))
least = list()
for i in range(0, k):
	j = i
	count = 0
	w = 0
	while count < len(work):
		count += k
		w += work[j]
		j += k
		j = j % len(work)
	least.append(w)
print(least.index(min(least)) + 1)


import sys

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))
temparr = get_ints()
dicts = {}
arr = get_ints()
n = int(temparr[0])
k = int(temparr[1])
dp = [0 for _ in range(k)]
index = 0
for i in arr:
	if index == k:
		index = 0
	dp[index] += i
	index += 1
minsum = dp[0]
index = 0
for (j, i) in enumerate(dp):
	if i < minsum:
		index = j
		minsum = i
print(index + 1)


import sys
import math
import itertools
import functools
import collections

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
(n, k) = mi()
a = li()
ans = []
for i in range(k):
	ans.append(sum(a[i:n:k]))
print(ans.index(min(ans)) + 1)


import sys
import math
(n, k) = [int(x) for x in sys.stdin.readline().split()]
an = [int(x) for x in sys.stdin.readline().split()]
vmin = 1000000000
rez = 0
for i in range(k):
	vsum = 0
	vvmin = 1001
	for j in range(i, n, k):
		vsum += an[j]
	if vsum < vmin:
		vmin = vsum
		rez = i + 1
print(rez)


import sys

def readInputs():
	global n, k, tab
	(n, k) = map(int, f.readline().split())
	tab = list(map(int, f.readline().split()))

def solve():
	tabCum = n * [0]
	for i in range(k):
		tabCum[i] = tab[i]
		j = (i + k) % n
		while j != i:
			tabCum[i] += tab[j]
			j = (j + k) % n
	iMin = 0
	valMin = tabCum[0]
	for i in range(1, k):
		if tabCum[i] < valMin:
			valMin = tabCum[i]
			iMin = i
	return iMin + 1

def main():
	global f
	f = sys.stdin
	readInputs()
	print(solve())
main()


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
temp = l[:]
l = l + l
mini = 10 ** 9

def check(arr):
	sm = 0
	sm = sum([arr[i] for i in range(0, n, k)])
	return sm
for i in range(k, 2 * n):
	l[i] += l[i - k]
for i in range(n - k, 2 * n):
	if l[i] < mini:
		mini = l[i]
		ans = i - (n - k) + 1
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in range(n):
	d[i] = a[i]
maxi = 999999999999999999999
imd = 0
for i in range(k):
	c = (i + k) % n
	powe = a[i]
	while c > i:
		powe += a[c]
		c = (c + k) % n
	if maxi > powe:
		maxi = powe
		inde = i
print(inde + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
minsum = sum(a)
imin = 0
for i in range(k):
	if sum(a[i::k]) < minsum:
		minsum = sum(a[i::k])
		imin = i
print(imin + 1)


(n, k) = [int(x) for x in input().split()]
list1 = [int(x) for x in input().split()]
ans = 9999999999
ind = n + 3
for i in range(n):
	temp = 0
	for j in range(i, n, k):
		temp += list1[j]
	if temp < ans:
		ans = temp
		ind = i
	if j == n - 1:
		break
print(ind + 1)