After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The balls are numbered with numbers from 1 to n.

Valeric decided to sort the balls in the order of increasing of their numbers by the following scheme. He will put each new ball in the basket with the least number of balls. And if he's got several variants, he chooses the basket which stands closer to the middle. That means that he chooses the basket for which <image> is minimum, where i is the number of the basket. If in this case Valeric still has multiple variants, he chooses the basket with the minimum number.

For every ball print the number of the basket where it will go according to Valeric's scheme.

Note that the balls are sorted into baskets in the order of increasing numbers, that is, the first ball goes first, then goes the second ball and so on.

Input

The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.

Output

Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.

Examples

Input

4 3


Output

2
1
3
2


Input

3 1


Output

1
1
1

Difficulty: EASY

Solutions:
(n, m) = map(int, input().split())
l = []
if m % 2 == 1:
	l = [(m + 1) // 2]
	for i in range((m - 1) // 2, 0, -1):
		l.append(i)
		l.append(m - i + 1)
else:
	l = []
	for i in range(m // 2, 0, -1):
		l.append(i)
		l.append(m - i + 1)
for i in range(n):
	print(l[i % len(l)])


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().split())
li = []
j = (m + 1) // 2
k = j
if m % 2 == 0:
	li.append(j)
	j -= 1
	k += 1
	li.append(k)
	k += 1
	i = 2
else:
	li.append(j)
	j -= 1
	k += 1
	i = 1
for _ in range(i, m, 2):
	li.append(j)
	j -= 1
	li.append(k)
	k += 1
li2 = []
j = 0
for i in range(0, n):
	if j == m:
		j = 0
	li2.append(li[j])
	j += 1
for i in range(n):
	print(li2[i])


(n, m) = map(int, input().split())
if m % 2 == 0:
	dis = 0
	while n > 0:
		if dis == 0:
			print((m + 1) // 2)
			dis += 1
			n -= 1
		elif dis == (m + 1) // 2:
			print((m + 1) // 2 + dis)
			n -= 1
			dis = 0
		else:
			print((m + 1) // 2 + dis)
			n -= 1
			if n > 0:
				print((m + 1) // 2 - dis)
				n -= 1
			dis += 1
else:
	dis = 0
	while n > 0:
		if dis == 0:
			print((m + 1) // 2)
			dis += 1
			n -= 1
		elif dis == (m + 1) // 2:
			dis = 0
		else:
			print((m + 1) // 2 - dis)
			n -= 1
			if n > 0:
				print((m + 1) // 2 + dis)
				n -= 1
			dis += 1


(n, m) = map(int, input().split())
tab = [0] * n
i = 1
if m % 2 == 0:
	pos = m // 2
	while i <= n:
		tab[i - 1] = pos
		if pos == m:
			pos = m // 2
		elif pos <= m // 2:
			pos = m // 2 + 1 + (m // 2 - pos)
		else:
			pos = m // 2 - (pos - (m // 2 + 1)) - 1
		i += 1
else:
	pos = (m + 1) // 2
	while i <= n:
		tab[i - 1] = pos
		if pos == m:
			pos = (m + 1) // 2
		elif pos < (m + 1) // 2:
			pos = (m + 1) // 2 + ((m + 1) // 2 - pos)
		else:
			pos = (m + 1) // 2 - (pos - (m + 1) // 2) - 1
		i += 1
print('\n'.join(map(str, tab)))


(n, m) = map(int, input().split())
res = []
t = 1 if m % 2 else -1
for i in range(m):
	res.append(m // 2 + m % 2 + (i + 1) // 2 * t)
	t *= -1
for i in range(n):
	print(res[i % m])


import math
from collections import Counter
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
(n, m) = M()
a = [math.ceil(m / 2)]
k = 1
j = 1
for i in range(m - 1):
	if i % 2 == 0 and m % 2 == 1:
		a.append(a[0] - j)
		j += 1
	elif i % 2 == 1 and m % 2 == 1:
		a.append(a[0] + k)
		k += 1
	elif i % 2 == 0 and m % 2 == 0:
		a.append(a[0] + k)
		k += 1
	elif i % 2 == 1 and m % 2 == 0:
		a.append(a[0] - j)
		j += 1
a *= n // m + 1
for i in range(n):
	print(a[i])


(n, m) = [int(x) for x in input().split()]
l = [i + 1 for i in range(m)]
h = []
while len(l) > 0:
	c = len(l)
	if c % 2 == 1:
		h.append(l.pop(c // 2))
	else:
		h.append(l.pop(c // 2 - 1))
for i in range(n):
	print(h[i % m])


(n, m) = map(int, input().split())
l = [i for i in range(1, m + 1)]
a = []
i = 0
b = m
while m:
	a.append(l[-i - 1])
	m -= 1
	if m:
		a.append(l[i])
		m -= 1
	i += 1
a = a[::-1]
i = 0
while n - i:
	print(a[i % b])
	i += 1


from sys import stdin, stdout
from os import path
rd = lambda : stdin.readline().strip()
wr = stdout.write
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
import time
(x, y) = map(int, rd().split())
arr = [(abs((y + 1) / 2 - (k + 1)), k + 1) for k in range(y)]
arr.sort()
for i in range(x):
	ind = i % y
	print(arr[ind][1])


(n, m) = map(int, input().split())
t1 = [[abs((m + 1) / 2 - (k + 1)), k + 1] for k in range(m)]
t1.sort()
for i in range(n):
	ind = i % m
	print(t1[ind][1])


(n, m) = map(int, input().split())
if m % 2 != 0:
	mid = m // 2 + 1
	l1 = []
	l1.append(mid)
	for i in range(1, mid):
		l1.append(mid - i)
		l1.append(mid + i)
else:
	l1 = []
	mid = int(m / 2)
	l1.append(mid)
	mid2 = int(m / 2) + 1
	l1.append(mid2)
	for i in range(1, mid):
		l1.append(mid - i)
		l1.append(mid2 + i)
for x in range(0, n):
	print(l1[x % m])


(n, m) = list(map(int, input().split(' ')))
if m % 2 != 0:
	mid = int((m + 1) / 2)
	i = mid
	j = mid
else:
	mid = int(m / 2)
	i = mid
	j = mid + 1
detector = 1
if m == 1:
	for x in range(n):
		print(1)
else:
	for _ in range(n):
		if i == j:
			print(mid)
			i -= 1
			j += 1
			detector = 1
			continue
		if m % 2 != 0:
			if detector == -1:
				print(j)
				j += 1
				if j == m + 1:
					j = mid
				detector *= -1
			elif detector == 1:
				print(i)
				i -= 1
				if i == 0:
					i = mid
				detector *= -1
		elif m % 2 == 0:
			if detector == 1:
				print(i)
				i -= 1
				if i == 0:
					i = mid
				detector *= -1
			elif detector == -1:
				print(j)
				j += 1
				if j == m + 1:
					j = mid + 1
				detector *= -1


(n, m) = list(map(int, input().split()))
l = [0] * (n + 1)
b = [0] * (m + 1)
m1 = (m + 1) // 2
if m % 2 == 1:
	for i in range(1, n + 1):
		if i <= m:
			if i % 2 == 1:
				l[i] = m1 + i // 2
			else:
				l[i] = m1 - i // 2
		else:
			l[i] = l[i - m]
if m % 2 == 0:
	for i in range(1, n + 1):
		if i <= m:
			if i % 2 == 1:
				l[i] = m1 - i // 2
			else:
				l[i] = m1 + i // 2
		else:
			l[i] = l[i - m]
for i in range(1, n + 1):
	print(l[i])


def func(i):
	return abs((m + 1) / 2 - i)
a = input()
[n, m] = a.split(' ')
[n, m] = [int(n), int(m)]
a = [i for i in range(1, m + 1)]
a.sort(key=func)
i = 0
while i < n:
	print(a[i % m])
	i += 1


(n, m) = map(int, input().split())
d = {i + 1: 0 for i in range(n)}
if m % 2 == 1:
	i = 0
	t = int(m / 2) + 1
	r = t
	while i < n:
		if r == t:
			d[i + 1] = t
			r = 1
			i = i + 1
		if i < n:
			if t == r:
				r = 0
			d[i + 1] = t - r
			i = i + 1
		if i < n:
			if t == r:
				r = 0
			d[i + 1] = t + r
			i = i + 1
			r = r + 1
elif m % 2 == 0:
	i = 0
	t = int(m / 2)
	t1 = int(m / 2) + 1
	r = 0
	while i < n:
		if r == t:
			r = 0
		if i < n:
			d[i + 1] = t - r
			i = i + 1
		if i < n:
			d[i + 1] = t1 + r
			i = i + 1
			r = r + 1
for i in d:
	print(d[i])


from sys import exit
(n, m) = map(int, input().split())
mid = (m + 1) / 2
st = list()
if m == 1:
	for i in range(n):
		print(1)
	exit(0)
if m % 2 == 0:
	i = int(m / 2)
	k = 0
	while i < m and i >= 0:
		if k % 2 == 0:
			i -= k
		else:
			i += k
		st.append(i)
		k += 1
else:
	i = int(m / 2) + 1
	k = 0
	while i < m and i >= 0:
		if k % 2 == 0:
			i += k
		else:
			i -= k
		st.append(i)
		k += 1
num = int(n / m)
ext = n % m
st = st * num + st[:ext]
print(*st, sep='\n')


(n, m) = list(map(int, input().split()))
if m % 2 == 0:
	mid = int((m + 1) / 2)
	mid1 = int((m + 1) / 2) + 1
	arr1 = []
	arr2 = []
	for i in range(mid, 0, -1):
		arr1.append(i)
	for j in range(mid1, m + 1):
		arr2.append(j)
	counter = 1
	actual = 0
	for o in range(n):
		if counter % 2:
			print(arr1[actual])
		else:
			print(arr2[actual])
			actual += 1
			actual %= len(arr2)
		counter += 1
		counter %= m
else:
	mid = int((m + 1) / 2)
	arr1 = []
	arr2 = []
	for i in range(mid - 1, 0, -1):
		arr1.append(i)
	for j in range(mid + 1, m + 1):
		arr2.append(j)
	counter = 0
	actual = 0
	for k in range(n):
		if counter:
			if counter % 2:
				print(arr1[actual])
			else:
				print(arr2[actual])
				actual += 1
				actual %= len(arr2)
			counter += 1
			counter %= m
		else:
			print(mid)
			counter += 1
			counter %= m


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().split())
k = (m + 1) // 2
for i in range(n // m):
	if m % 2:
		stdout.write(str(k) + '\n')
		l = k - 1
		r = k + 1
		for i in range((m - 1) // 2):
			stdout.write(str(l) + '\n' + str(r) + '\n')
			l -= 1
			r += 1
	else:
		l = k
		r = k + 1
		for j in range(m // 2):
			stdout.write(str(l) + '\n' + str(r) + '\n')
			l -= 1
			r += 1
n %= m
if m % 2 and n:
	stdout.write(str(k) + '\n')
	l = k - 1
	r = k + 1
	n -= 1
	while n:
		if n > 1:
			stdout.write(str(l) + '\n' + str(r) + '\n')
			l -= 1
			r += 1
			n -= 2
		else:
			stdout.write(str(l))
			n -= 1
			break
elif n:
	l = k
	r = k + 1
	while n:
		if n > 1:
			stdout.write(str(l) + '\n' + str(r) + '\n')
			l -= 1
			r += 1
			n -= 2
		else:
			stdout.write(str(l))
			n -= 1
			break


from sys import *
input = stdin.readline
(n, m) = map(int, input().split())
rishabh = (m + 1) // 2
ans = []
smh = rishabh
for kk in range(n):
	ans.append(smh)
	if smh == rishabh and m % 2 == 1:
		smh -= 1
	elif smh <= rishabh:
		smh = m - smh + 1
	else:
		smh = m - smh
	if smh == 0:
		smh = rishabh
for kkk in ans:
	print(kkk)


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())
import math
(n, m) = rinput()

def get_list(lower, upper):
	if lower == upper:
		ans = [lower]
	else:
		ans = [lower, upper]
	for i in range(1, lower):
		ans.extend([lower - i, upper + i])
	return ans
if m % 2 != 0:
	lower = (m + 1) // 2
	ans = get_list(lower, lower)
else:
	start = (m + 1) / 2
	lower = math.floor(start)
	upper = math.ceil(start)
	ans = get_list(lower, upper)
i = j = 0
while i < n:
	print(ans[j])
	j = (j + 1) % len(ans)
	i += 1


(n, m) = map(int, input().split())
center = (m + 1) // 2
result = []
pos = center
for i in range(n):
	result.append(pos)
	if pos == center and m % 2 == 1:
		pos -= 1
	elif pos <= center:
		pos = m - pos + 1
	else:
		pos = m - pos
	if pos == 0:
		pos = center
print('\n'.join(list(map(str, result))))


(n, m) = map(int, input().split())
D = set()
for i in range(m):
	D.add(i + 1)
A = []
k = 0
t = n
if n > m:
	k = n // m
	t = n % m

def mod(x):
	if x < 0:
		return -x
	return x
p = (m + 1) // 2
q = p + 1
for j in range(min(m, n)):
	if mod((m + 1) / 2 - p) <= mod((m + 1) / 2 - q) and p >= 1 and (p in D):
		A.append(p)
		D.remove(p)
		p -= 1
	else:
		A.append(q)
		D.remove(q)
		q += 1
C = []
if k > 0:
	B = A * k
C = A[:t]
if k == 0:
	V = C
else:
	V = B + C
for i in range(len(V)):
	print(V[i])


(n, m) = map(int, input().split())
center = (m + 1) // 2
pos = center
for i in range(n):
	print(pos)
	if pos == center and m % 2 == 1:
		pos -= 1
	elif pos <= center:
		pos = m - pos + 1
	else:
		pos = m - pos
	if pos == 0:
		pos = center


(n, m) = map(int, input().split())
a = []
if m % 2 == 0:
	t1 = m // 2
	t2 = m // 2 + 1
	while t1 > 0 or t2 < m:
		a.append(t1)
		a.append(t2)
		t1 -= 1
		t2 += 1
else:
	t1 = m // 2
	t2 = t1 - 1
	t3 = t1 + 1
	a.append(t1 + 1)
	while t2 >= 0 and t3 < m:
		a.append(t2 + 1)
		a.append(t3 + 1)
		t2 -= 1
		t3 += 1
if n // m == 0:
	for i in range(n):
		print(a[i])
else:
	t1 = n // m
	while t1 != 0:
		for i in range(m):
			print(a[i])
		t1 -= 1
	t2 = n % m
	for i in range(m):
		if i < t2:
			print(a[i])
		else:
			break


(n, m) = map(int, input().split())
if m % 2 == 0:
	ans = []
	for i in range(m // 2, 0, -1):
		ans.append(i)
		ans.append(m - i + 1)
	z = n // m
	k = ans * z
	k = k + ans[0:n % m]
else:
	ans = [m // 2 + 1]
	for i in range(m // 2, 0, -1):
		ans.append(i)
		ans.append(m - i + 1)
	z = n // m
	k = ans * z
	k = k + ans[0:n % m]
for i in k:
	print(i)


(n, m) = map(int, input().split())
a = [str((m + 1) // 2 + (1 - 2 * ((m + i % m - 1) % 2)) * ((i % m + 1) // 2)) for i in range(n)]
print('\n'.join(a))


import heapq
(n, m) = map(int, input().split())
l = []
for i in range(1, m + 1):
	capacity = 0
	if m % 2 != 0:
		pref1 = abs((m + 1) // 2 - i)
		pref2 = 0
		pref3 = i
		l.append((capacity, pref1, pref2, pref3))
	else:
		pref1 = abs(m // 2 - i)
		pref2 = abs(m // 2 + 1 - i)
		pref3 = i
		l.append((capacity, pref1, pref2, pref3))
heapq.heapify(l)
for i in range(n):
	(c, p1, p2, p3) = heapq.heappop(l)
	print(p3)
	c += 1
	heapq.heappush(l, (c, p1, p2, p3))


(n, m) = [int(i) for i in input().split()]
if m == 1:
	print('1\n' * n)
	exit()
it1 = m // 2
it2 = m // 2 + 1
a = [-1] * n
i = 0
while i < n:
	if it1 < 1:
		it1 = m // 2
	if it2 > m:
		it2 = m // 2 + 1
	if m % 2 == 1 and it2 == m // 2 + 1:
		a[i] = it2
		it2 += 1
		i += 1
	if i < n:
		a[i] = it1
		it1 -= 1
		i += 1
	if i < n:
		a[i] = it2
		it2 += 1
		i += 1
print('\n'.join([str(i) for i in a]))


(n, m) = map(int, input().split())
low = 1
high = m
if m % 2 == 0:
	m1 = m // 2
	m2 = m // 2 + 1
	ans = []
	for i in range(m // 2):
		ans.append(m1 - i)
		ans.append(m2 + i)
	for i in range(n):
		print(ans[i % m])
	exit()
else:
	ans = [m // 2 + 1, m // 2, m // 2 + 2]
	m1 = ans[1]
	m2 = ans[2]
	for i in range((m - 3) // 2):
		ans.append(m1 - i - 1)
		ans.append(m2 + i + 1)
	for i in range(n):
		print(ans[i % m])


(n, m) = map(int, input().split())
if m % 2:
	while n:
		i = (m + 1) // 2
		k = 1
		j = 0
		while n and i > 0 and (i <= m):
			print(i)
			if j % 2 == 0:
				i -= k
			else:
				i += k
			k += 1
			n -= 1
			j += 1
else:
	while n:
		i = (m + 1) // 2
		k = 1
		j = 0
		while n and i > 0 and (i <= m):
			print(i)
			if j % 2:
				i -= k
			else:
				i += k
			k += 1
			n -= 1
			j += 1


(n, m) = [int(x) for x in input().split()]
if m % 2 == 0:
	c = m // 2
else:
	c = m // 2 + 1
a = [c]
a1 = []
for i in range(c - 1, 0, -1):
	a1.append(i)
a2 = []
for i in range(c + 1, m + 1):
	a2.append(i)
i = 0
j = 0
if m % 2 != 0:
	while i < c - 1 or j < m - c:
		if i < c - 1:
			a.append(a1[i])
		if j < m - c:
			a.append(a2[j])
		i += 1
		j += 1
else:
	while i < c - 1 or j < m - c:
		if j < m - c:
			a.append(a2[j])
		if i < c - 1:
			a.append(a1[i])
		i += 1
		j += 1
x = n // m
ans = a * x
y = n % m
ans += a[0:y]
for i in ans:
	print(i)


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, input().split()))
for _ in range(1):
	(n, k) = lst()
	ans = [(1 + k) // 2]
	ln = 1
	val = 1
	while ln < k:
		ans += [(1 + k) // 2 - (val if k & 1 else -val)]
		ln += 1
		if ln == k:
			break
		ans += [(1 + k) // 2 + (val if k & 1 else -val)]
		val += 1
		ln += 1
		if ln == k:
			break
	for i in range(n):
		print(ans[i % k])


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, m) = iia()
mid = (m + 1) // 2
l = r = mid
l1 = r1 = True
while n != 0:
	if l1 and r1:
		n -= 1
		print(mid)
		l = mid - 1
		r = mid + 1
		l1 = r1 = False
	(c1, c2) = (abs((m + 1) / 2 - l), abs((m + 1) / 2 - r))
	if l > 0 and n and (c1 <= c2):
		print(l)
		l -= 1
		n -= 1
	if l == 0:
		l1 = True
	if r <= m and n:
		print(r)
		r += 1
		n -= 1
	if r == m + 1:
		r1 = True


(n, m) = map(int, input().split())
count = 0
c = (m + 1) // 2
k = 0
if m % 2 == 0:
	for i in range(n):
		if count == 0:
			k = 0
			print(c + k)
			count += 1
			k += 1
		elif count % 2 != 0:
			if 1 <= c + k <= m:
				print(c + k)
				count += 1
			elif 1 <= c - k <= m:
				print(c - k)
				count += 1
		elif count % 2 == 0:
			if 1 <= c - k <= m:
				print(c - k)
				count += 1
			elif 1 <= c + k <= m:
				print(c + k)
				count += 1
			k += 1
		if count == m:
			count = 0
else:
	for i in range(n):
		if count == 0:
			k = 0
			print(c + k)
			count += 1
			k += 1
		elif count % 2 == 0:
			if 1 <= c + k <= m:
				print(c + k)
				count += 1
			elif 1 <= c - k <= m:
				print(c - k)
				count += 1
			k += 1
		elif count % 2 != 0:
			if 1 <= c - k <= m:
				print(c - k)
				count += 1
			elif 1 <= c + k <= m:
				print(c + k)
				count += 1
		if count == m:
			count = 0


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
if m % 2 != 0:
	l = [(m + 1) // 2]
	for i in range(1, (m + 1) // 2):
		l.append((m + 1) // 2 - i)
		l.append((m + 1) // 2 + i)
elif m == 2:
	l = [1, 2]
else:
	l = [m // 2]
	for i in range(1, m // 2):
		l.append(m // 2 + i)
		l.append(m // 2 - i)
	l.append(m)
ans = l * (n // len(l))
ans += l[0:n % len(l)]
for i in range(n):
	print(ans[i])


from sys import stdin, stdout, setrecursionlimit
from collections import deque

class Tail_Recursion_Optimization:

	def __init__(self, RECURSION_LIMIT, STACK_SIZE):
		setrecursionlimit(RECURSION_LIMIT)
		threading.stack_size(STACK_SIZE)
		return None

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		(n, m) = [int(x) for x in R().split()]
		a = (m + 1) // 2
		b = a + (-1 if m % 2 else 1)
		boxes = deque()
		while 1 <= a <= m and 1 <= b <= m:
			boxes.append(str(a))
			boxes.append(str(b))
			a += 1 if m % 2 else -1
			b += -1 if m % 2 else 1
		if m % 2:
			boxes.append(str(m))
		for i in range(1, n + 1):
			current_box = boxes.popleft()
			ans.append(current_box)
			boxes.append(current_box)
		W('\n'.join(ans))
		return 0

def main():
	s = SOLVE()
	s.solve()
main()


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, m) = f()
if m & 1:
	l = [(m + 1) // 2]
else:
	l = [m // 2, m // 2 + 1]
for i in range(1, (m + 1) // 2):
	if m & 1:
		l.extend([(m + 1) // 2 - i, (m + 1) // 2 + i])
	else:
		l.extend([m // 2 - i, m // 2 + i + 1])
for i in range(n):
	print(l[i % m])


(n, m) = map(int, input().split())
ce = (m + 1) // 2
po = ce
for i in range(n):
	print(po)
	if po == ce and m % 2 == 1:
		po -= 1
	elif po <= ce:
		po = m - po + 1
	else:
		po = m - po
	if po == 0:
		po = ce


(n, m) = map(int, input().split())
x = [i for i in range(1, m + 1)]
p = m // 2
s = []
if m % 2:
	if m > 1:
		s.append(x[p])
		l = p - 1
		r = p + 1
		while l >= 0 and r < m:
			if x[l] < x[r]:
				s.append(x[l])
				s.append(x[r])
			else:
				s.append(x[r])
				s.append(x[l])
			l -= 1
			r += 1
	elif m == 1:
		s = [1]
else:
	s.append(x[p - 1])
	s.append(x[p])
	l = p - 2
	r = p + 1
	while l >= 0 and r < m:
		if x[l] < x[r]:
			s.append(x[l])
			s.append(x[r])
		else:
			s.append(x[r])
			s.append(x[l])
		l -= 1
		r += 1
q = n // m
d = n % m
ans = s * q + s[:d]
for i in range(len(ans)):
	print(ans[i])


(n, m) = map(int, input().split())
k = (m + 1) // 2
t = [k] * m
d = m % 2
for (i, j) in enumerate(range(1 + d, m, 2), 1):
	t[j] += i
for (i, j) in enumerate(range(2 - d, m, 2), 1):
	t[j] -= i
t = (((n - 1) // m + 1) * t)[:n]
print('\n'.join(map(str, t)))


(n, m) = map(int, input().split())
p = [0] * (n + 1)
t = [0] + [[j + i for i in range(0, n - j + 1, m)] for j in range(m - 1, m % 2, -2)] + [[j + i for i in range(0, n - j + 1, m)] for j in range(2 - m % 2, m + 1, 2)]
for j in range(1, m + 1):
	for i in t[j]:
		p[i] = str(j)
print('\n'.join(p[1:]))


(n, m) = map(int, input().split())
x1 = (m + 1) // 2
x2 = x1 + 1
c = 0
i = 0
if m % 2 != 0:
	while n != 0:
		i = 0
		mm = m
		while mm != 0 and n != 0:
			if i == 0:
				print(x1)
				i += 1
				mm -= 1
				n -= 1
			else:
				if mm and n:
					print(x1 - i)
					mm -= 1
					n -= 1
				if mm and n:
					print(x1 + i)
					mm -= 1
					n -= 1
				i += 1
else:
	while n != 0:
		i = 0
		mm = m
		while mm != 0 and n != 0:
			if i == 0:
				if n and m:
					print(x1)
					mm -= 1
					n -= 1
				if n and m:
					print(x2)
					mm -= 1
					n -= 1
				i += 1
			else:
				if n and mm != 0:
					print(x1 - i)
					mm -= 1
					n -= 1
				if n:
					print(x2 + i)
					mm -= 1
					n -= 1
				i += 1


def checkKey(dict, key):
	if key in dict:
		return True
	return False
(n, m) = map(int, input().split())
mid = (m + 1) // 2
index = 1
ans = ''
l = [i for i in range(1, m + 1)]
arr = [mid]
if m % 2 == 0:
	while True:
		flag = 0
		if mid + index <= m:
			arr.append(mid + index)
			flag = 1
		if mid - index > 0:
			arr.append(mid - index)
			flag = 1
		index += 1
		if flag == 0:
			break
else:
	while True:
		flag = 0
		if mid - index > 0:
			arr.append(mid - index)
			flag = 1
		if mid + index <= m:
			arr.append(mid + index)
			flag = 1
		index += 1
		if flag == 0:
			break
for i in range(n):
	print(arr[i % len(arr)])


(n, m) = map(int, input().split())
p1 = (m - 1) // 2
p2 = m // 2
if m % 2:
	p1 = m // 2
order = [p1]
if p1 != p2:
	order.append(p2)
while p1 > 0 and p2 < m - 1:
	p1 -= 1
	p2 += 1
	order.append(p1)
	order.append(p2)
while p1 > 0:
	p1 -= 1
	order.append(p1)
while p2 < m - 1:
	p2 += 1
	order.append(p2)
for i in range(n):
	print(order[i % m] + 1)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
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
mod = pow(10, 9) + 7
mod2 = 998244353

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

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

def outln(var):
	sys.stdout.write(str(var) + '\n')

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)]
(n, m) = sp()
answer = []
for i in range(1, m + 1):
	answer.append((0, abs(m + 1 - 2 * i) // 2, i))
heapify(answer)
for i in range(1, n + 1):
	temp = heappop(answer)
	outln(temp[2])
	heappush(answer, (temp[0] + 1, temp[1], temp[2]))


(n, m) = map(int, input().split())
print(*((m + 1) // 2 + (1 - 2 * ((m - 1 + i % m) % 2)) * ((1 + i % m) // 2) for i in range(n)), sep='\n')


(n, m) = map(int, input().split())
A = [m - 2 * i for i in range(1, 1 + m // 2)] + [2 * i - 1 - m % 2 for i in range(1, (m + 3) // 2)]
d = {a: i for (i, a) in enumerate(A, 1)}
print(*(d[i % m] for i in range(n)), sep='\n')


(n, m) = map(int, input().split())
if m % 2 == 1:
	mid = m // 2 + 1
	ans = []
	ans.append(mid)
	for j in range(1, m // 2 + 1):
		ans.append(mid - j)
		ans.append(mid + j)
	for i in range(n):
		print(ans[i % m])
if m % 2 == 0:
	mid1 = m // 2
	mid2 = m // 2 + 1
	ans = []
	ans.append(mid1)
	ans.append(mid2)
	for j in range(1, m // 2):
		ans.append(mid1 - j)
		ans.append(mid2 + j)
	for i in range(n):
		print(ans[i % m])


import math
(n, m) = map(int, input().strip().split(' '))
if m == 1:
	for j in range(n):
		print(1)
elif m == 2:
	for j in range(n):
		if j % 2 == 0:
			print(1)
		else:
			print(2)
elif m % 2 != 0:
	mid = m // 2 + 1
	for j in range(1, n + 1):
		k = j % m
		if k == 1:
			print(mid)
		elif k == 0:
			print(m)
		elif (k - 1) % 2 != 0:
			print(mid - math.ceil((k - 1) / 2))
		else:
			print(mid + (k - 1) // 2)
else:
	mid = m // 2
	for j in range(1, n + 1):
		k = j % m
		if k == 1:
			print(mid)
		elif k == 0:
			print(m)
		elif k % 2 == 0:
			print(mid + k // 2)
		else:
			print(mid - k // 2)


(n, m) = list(map(int, input().split()))
middle = (m + 1) // 2
left = middle - 1
right = middle + 1
if m % 2 == 1:
	turn = 'left'
else:
	turn = 'right'
output = [middle]
while left >= 1 or right <= min(n, m):
	if turn == 'right':
		output.append(right)
		right += 1
		turn = 'left'
	else:
		output.append(left)
		left -= 1
		turn = 'right'
for i in range(n // m):
	for j in output:
		print(j)
for i in output[:n % m]:
	print(i)


(n, m) = map(int, input().split())
if n == 1:
	print((m + 1) // 2)
else:
	c = []
	j = 0
	ans = []
	if m % 2 == 0:
		l = (m + 1) // 2
		r = l + 1
	else:
		c.append((m + 1) // 2)
		l = (m + 1) // 2 - 1
		r = (m + 1) // 2 + 1
	for i in range(m // 2):
		c.append(l - i)
		c.append(r + i)
	for i in range(n // m):
		ans += c
	ans += c[:n % m]
	for i in ans:
		print(i)


(n, m) = input().split()
(n, m) = (int(n), int(m))
for i in range(n):
	j = i % m
	if m % 2 == 1:
		if j % 2 == 0:
			print(int(m / 2 + j / 2) + 1)
		else:
			print(int(m / 2 - (j + 1) / 2) + 1)
	elif j % 2 == 0:
		print(int(m / 2 - j / 2))
	else:
		print(int(m / 2 + (j + 1) / 2))


(n, m) = map(int, input().split())
filling_order = []
if m % 2 == 0:
	z = 1
	k = 0
	temp = int(m / 2)
	while True:
		filling_order.append(temp)
		if temp == m:
			break
		temp += (-1) ** k * z
		z += 1
		k += 1
else:
	z = 1
	k = 1
	temp = int((m + 1) / 2)
	while True:
		filling_order.append(temp)
		if temp == m:
			break
		temp += (-1) ** k * z
		k += 1
		z += 1
j = 0
while n:
	print(filling_order[j % m])
	j += 1
	n -= 1


from sys import stdin
inp = stdin.readline
(n, m) = map(int, inp().split())
ans = []
if m & 1:
	mid = m // 2 + 1
	ans.append(str(int(mid)))
	k = 1
	n -= 1
	while True:
		if n == 0:
			break
		if mid - k < 1:
			k = 1
			ans.append(str(int(mid)))
			n -= 1
			continue
		ans.append(str(int(mid - k)))
		n -= 1
		if n == 0:
			break
		ans.append(str(int(mid + k)))
		n -= 1
		k += 1
else:
	mid = m // 2
	ans.append(str(int(mid)))
	k = 1
	n -= 1
	while True:
		if n == 0:
			break
		ans.append(str(int(mid + k)))
		n -= 1
		if n == 0:
			break
		if mid - k < 1:
			k = 1
			ans.append(str(int(mid)))
			n -= 1
			continue
		ans.append(str(int(mid - k)))
		n -= 1
		k += 1
print('\n'.join(ans))


from math import ceil, floor
from itertools import islice
(n, m) = map(int, input().split(' '))

def get_bucket_order(num_bucket):
	start = (num_bucket + 1) / 2
	width = int(floor(num_bucket / 2))
	while True:
		if num_bucket % 2 == 1:
			yield int(start)
		for offset in range(1, width + 1):
			yield (1 if start - offset < 1 else ceil(start - offset))
			yield floor(start + offset)
for x in islice(get_bucket_order(m), 0, n):
	print(x)


from sys import stdin, stdout
(n, m) = map(int, input().split())
basket = [0] * m
a = (m + 1) // 2
s = 0
f = 0
q = 0
d = []
aaa = ''
for i in range(1, n + 1):
	if i <= m:
		if i == 1:
			basket[a - 1] += 1
			d.append(a)
			aaa += str(a)
			aaa += '\n'
			j = 1
			x = 1
			f = 0
		elif m % 2 == 0 and f == 0:
			basket[a] += 1
			d.append(a + 1)
			aaa += str(a + 1)
			aaa += '\n'
			x += 1
			f = 1
		elif s == 0:
			d.append(a - j)
			aaa += str(a - j)
			aaa += '\n'
			basket[a - j - 1] += 1
			s = 1
		else:
			d.append(a + x)
			aaa += str(a + x)
			aaa += '\n'
			basket[a + x - 1] += 1
			j += 1
			x += 1
			s = 0
	else:
		aaa += str(d[i % m - 1])
		aaa += '\n'
stdout.write(aaa)


(n, m) = list(map(int, input().split()))
(x, y) = ((m + 1) // 2, [])
p = x
for i in range(n):
	y.append(p)
	if p == x and m % 2 == 1:
		p -= 1
	elif p <= x:
		p = m - p + 1
	else:
		p = m - p
	if p == 0:
		p = x
for i in y:
	print(i)


def task(n, m):
	if m % 2 == 0:
		c = 0
	else:
		c = 1
	mid = m // 2 + c
	l = mid - 1
	hi = mid + 1
	print(mid)
	n -= 1
	if m % 2 != 0:
		while n:
			if l > 0:
				print(l)
				l -= 1
				n -= 1
			if hi <= m and n:
				print(hi)
				hi += 1
				n -= 1
			if hi > m and l <= 0:
				hi = mid + 1
				l = mid - 1
				if n:
					print(mid)
					n -= 1
		return ''
	else:
		while n:
			if hi <= m and n:
				print(hi)
				hi += 1
				n -= 1
			if l > 0 and n:
				print(l)
				l -= 1
				n -= 1
			if hi > m and l <= 0:
				hi = mid + 1
				l = mid - 1
				if n:
					print(mid)
					n -= 1
		return ''
(a, b) = map(int, input().strip().split())
print(task(a, b))


(n, m) = map(int, input().split(' '))
arr = []
mid = int((m + 1) / 2)
if m % 2 == 0:
	if m == 2:
		arr.append(mid)
		arr.append(mid + 1)
	else:
		arr.append(mid)
		for i in range(1, mid):
			arr.append(mid + i)
			arr.append(mid - i)
		arr.append(m)
else:
	arr.append(mid)
	for i in range(1, mid):
		arr.append(mid - i)
		arr.append(mid + i)
for i in range(n // m):
	for j in range(m):
		print(arr[j])
for i in range(n % m):
	print(arr[i])


(n, m) = map(int, input().split())
Even = False
if m % 2 == 0:
	mid = m // 2
	Even = True
else:
	mid = (m + 1) // 2
while n > 0:
	for i in range(1, min(m + 1, n + 1)):
		if i == 1:
			print(mid)
		elif Even:
			if i % 2 == 0:
				print(mid + i // 2)
			else:
				print(mid - (i - 1) // 2)
		elif i % 2 == 0:
			print(mid - i // 2)
		else:
			print(mid + (i - 1) // 2)
	n = n - m