Permutation p is an ordered set of integers p_1,   p_2,   ...,   p_{n}, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p_1,   p_2,   ...,   p_{n}.

Your task is to find such permutation p of length n, that the group of numbers |p_1 - p_2|, |p_2 - p_3|, ..., |p_{n} - 1 - p_{n}| has exactly k distinct elements.


-----Input-----

The single line of the input contains two space-separated positive integers n, k (1 ≤ k < n ≤ 10^5).


-----Output-----

Print n integers forming the permutation. If there are multiple answers, print any of them.


-----Examples-----
Input
3 2

Output
1 3 2

Input
3 1

Output
1 2 3

Input
5 2

Output
1 3 2 4 5



-----Note-----

By |x| we denote the absolute value of number x.

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

Constructive algorithms


Solutions:
(n, k) = map(int, input().split())
a = [n - i // 2 if i & 1 else i // 2 + 1 for i in range(n)]
a[k:] = sorted(a[k:])[::-1] if a[k - 1] > n / 2 else sorted(a[k:])
print(*a)


(a, b) = map(int, input().split(' '))
for i in range(1, a - b + 1):
	print(i)
curr = i
if b % 2 == 0:
	for i in range(b, 0, -1):
		if i % 2 == 0:
			curr = curr + i
		else:
			curr = curr - i
		print(curr)
else:
	for i in range(b, 0, -1):
		if i % 2 == 1:
			curr = curr + i
		else:
			curr = curr - i
		print(curr)


(n, k) = input().split()
n = int(n)
k = int(k) - 1
b = []
s = (k + 3) // 2
b.append(s)
i = 0
if k % 2 == 0:
	i = 1
else:
	i = -1
while k > -1:
	s = s + i
	b.append(s)
	if i > 0:
		i = -1 * i - 1
	else:
		i = -1 * i + 1
	k -= 1
while s < n:
	s += 1
	b.append(s)
for d in range(len(b)):
	print(b[d], end=' ')


(n, k) = [int(x) for x in input().split()]
repeated = n - k - 1
current = 1 + repeated
print(' '.join([str(x) for x in list(range(1, repeated + 2))]), end=' ')
for i in range(1, k + 1):
	current += (-1) ** (i + 1) * (k - i + 1)
	if i < k:
		print(current, end=' ')
	else:
		print(current)


(n, k) = map(int, input().split())
res = [1]
sum = True
for i in range(k, 0, -1):
	if sum == True:
		res.append(res[-1] + i)
		sum = False
	else:
		res.append(res[-1] - i)
		sum = True
if len(res) < n:
	for i in range(res[1] + 1, n + 1):
		res.append(i)
print(' '.join(map(str, res)))


lista = input()
lista = lista.split()
N = int(lista[0])
k = int(lista[1])
p = [1]
for indice in range(1, k + 1):
	siguiente = p[indice - 1] + (-1) ** (indice + 1) * (k - indice + 1)
	p.append(siguiente)
for indice in range(k + 1, N):
	siguiente = 1 + indice
	p.append(siguiente)
for n in p:
	print(n)


3
import sys

def __starting_point():
	(n, k) = list(map(int, sys.stdin.readline().split()))
	l = []
	i = 1
	j = k + 1
	while i <= j:
		l.append(str(i))
		i += 1
		if j > i:
			l.append(str(j))
			j -= 1
	for i in range(k + 2, n + 1):
		l.append(str(i))
	print(' '.join(l))
__starting_point()


(n, k) = (int(i) for i in input().split())
l = [i for i in range(1, n - k + 1)]
l1 = [i for i in range(n - k + 1, n + 1)]
k1 = 0
k2 = k - 1
for i in range(k):
	if i % 2 == 0:
		l.append(l1[k2])
		k2 -= 1
	else:
		l.append(l1[k1])
		k1 += 1
print(*l)


(n, k) = map(int, input().split())
A = [0] * (k + 1)
(A[::2], A[1::2]) = (range(1, k // 2 + 2), range(k + 1, k // 2 + 1, -1))
print(*A, *range(k + 2, n + 1))


(n, k) = map(int, input().split())
check = 1
c = n - k
for i in range(1, n - k + 1):
	print(i, end=' ')
for i in range(k, 0, -1):
	if check == 1:
		print(c + i, end=' ')
		c += i
		check = 0
	else:
		print(c - i, end=' ')
		c -= i
		check = 1
print()


def main():
	(n, k) = map(int, input().strip().split())
	a = b = k // 2 + 1
	delta = (k & 1) * 2 - 1
	res = []
	for _ in range(k // 2):
		res.append(a)
		a -= delta
		b += delta
		res.append(b)
	if k & 1:
		res.append(a)
	for a in range(k + 1, n + 1):
		res.append(a)
	print(*res)
main()


from sys import exit
(n, k) = map(int, input().split())
if n <= 2:
	print(*[i for i in range(1, n + 1)])
	exit()
else:
	d = [1]
	for i in range(n + 1):
		if k <= 0:
			break
		if i % 2 == 0:
			d.append(k + d[-1])
			k -= 1
		else:
			d.append(d[-1] - k)
			k -= 1
	if len(d) == n:
		print(*d)
	else:
		r = set(d)
		print(*d, *[i for i in range(1, n + 1) if i not in r])


import math
(n, k) = input().split()
n = int(n)
k = int(k)
p1 = 1
p2 = k + 1
final = []
while p1 <= math.ceil((k + 1) / 2):
	final.append(p1)
	p1 += 1
	if p2 > math.ceil((k + 1) / 2):
		final.append(p2)
		p2 -= 1
for y in range(k + 2, n + 1):
	final.append(y)
for x in final:
	print(x, end=' ')
print()


s = input().split()
(n, k) = (int(s[0]), int(s[1]))
x = 1
c = k
r = 0
for i in range(n):
	print(x, end=' ')
	x += (2 * ((i + 1) % 2) - 1) * c
	c -= 1
	if c < 0:
		r = n - (i + 1)
		break
for i in range(r):
	print((k + 1 + i) % n + 1, end=' ')


(n, k) = [int(i) for i in input().split()]
ans = ['1']
for i in range(k):
	if i % 2 == 0:
		ans.append(str(int(ans[-1]) + (k - i)))
	else:
		ans.append(str(int(ans[-1]) - (k - i)))
ans += [str(i) for i in range(k + 2, n + 1)]
print(' '.join(ans))


(n, k) = map(int, input().split())
cur = 1
x = 0
a = [0] * (n + 1)
while k > 0:
	a[cur] = 1
	print(cur, end=' ')
	if x == 0:
		cur = cur + k
		x = 1
	else:
		cur = cur - k
		x = 0
	k = k - 1
for i in range(1, n + 1):
	if a[i] == 0:
		print(i, end=' ')


(n, k) = list(map(int, input().split()))
a = []
for i in range(1, n - k + 1):
	a.append(i)
(i, j) = (n, n - k + 1)
for t in range(n - len(a)):
	if t % 2 == 0:
		a.append(i)
		i -= 1
	else:
		a.append(j)
		j += 1
print(' '.join(map(str, a)))


(n, k) = list(map(int, input().split()))
counter = n - k
diverse = True
i = 1
nums = []
while i <= counter:
	nums.append(i)
	i += 1
i = k
while i >= 1:
	if diverse:
		nums.append(counter + i)
		counter += i
		diverse = False
	else:
		nums.append(counter - i)
		counter -= i
		diverse = True
	i -= 1
print(*nums)


(n, k) = [int(x) for x in input().split()]
begin = 1
if k == 1:
	for x in range(1, n + 1):
		print(x, end=' ')
else:
	for y in range(n - k - 1):
		print(begin + y, end=' ')
	diff = n - k
	high = n
	while high >= diff + 1:
		print(diff, end=' ')
		print(high, end=' ')
		diff += 1
		if diff == high:
			break
		high -= 1
	if diff == high and k % 2 != 1:
		print(high)


(n, k) = map(int, input().split())
i = 1
a = []
for j in range(n // 2):
	a.append(i)
	a.append(n - i + 1)
	i += 1
if n % 2 == 1:
	a.append(n // 2 + 1)
for i in range(k):
	print(a[i], end=' ')
if k < n and a[k - 1] > a[k]:
	s = a[k - 1] - 1
	for i in range(k, n):
		print(s, end=' ')
		s -= 1
else:
	s = a[k - 1] + 1
	for i in range(k, n):
		print(s, end=' ')
		s += 1


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


import sys
(n, k) = map(int, input().split())
left = 1
right = n
turn = 0
while k > 0:
	if turn == 0:
		sys.stdout.write(str(left))
		left += 1
	else:
		sys.stdout.write(str(right))
		right -= 1
	sys.stdout.write(' ')
	k -= 1
	turn = 1 - turn
if turn == 1:
	cur = left
	while cur <= right:
		sys.stdout.write(str(cur))
		sys.stdout.write(' ')
		cur += 1
else:
	cur = right
	while cur >= left:
		sys.stdout.write(str(cur))
		sys.stdout.write(' ')
		cur -= 1


i = str.split(input(), ' ')
n = int(i[0])
k = int(i[1])
maxx = n
minn = 1
res = ''
for x in range(n - k):
	res += str(maxx) + ' '
	maxx -= 1
for z in range(k):
	if z % 2 == 0:
		res += str(minn) + ' '
		minn += 1
	else:
		res += str(maxx) + ' '
		maxx -= 1
res = res[:-1]
print(res)


(n, k) = map(int, input().split())
ll = [str(i) for i in range(1, k + 2)]
ll1 = []
for i in range(1, k + 1):
	ll1.append(ll[i - 1])
	ll1.append(ll[-i])
print(' '.join(ll1[0:k + 1] + [str(i) for i in range(k + 2, n + 1)]))


string = input()
(n, k) = string.split()
n = int(n)
k = int(k)
c = n - k
perm = True
output = ''
for i in range(1, n - k + 1):
	output += str(i) + ' '
i = k
output2 = ''
while i >= 1:
	if perm:
		output2 += str(c + i) + ' '
		c += i
		perm = False
	else:
		output2 += str(c - i) + ' '
		c -= i
		perm = True
	i -= 1
print(output + output2)


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


import sys
import math
MAXNUM = math.inf
MINNUM = -1 * math.inf
ASCIILOWER = 97
ASCIIUPPER = 65

def getInt():
	return int(sys.stdin.readline().rstrip())

def getInts():
	return map(int, sys.stdin.readline().rstrip().split(' '))

def getString():
	return sys.stdin.readline().rstrip()

def printOutput(lst):
	for ele in lst:
		sys.stdout.write(str(ele) + ' ')
	sys.stdout.write('\n')

def solve(n, k):
	lst = [1]
	top = n
	bottom = 2
	counter = 0
	while k - 1 > 0:
		if counter % 2 == 0:
			lst.append(top)
			top -= 1
		else:
			lst.append(bottom)
			bottom += 1
		counter += 1
		k -= 1
	if counter % 2 == 0:
		for i in range(bottom, top + 1):
			lst.append(i)
	else:
		for i in range(top, bottom - 1, -1):
			lst.append(i)
	return lst

def readinput():
	(n, k) = getInts()
	printOutput(solve(n, k))
readinput()


(n, k) = map(int, input().split())
solution = [1]
a = 1
b = 0
for i in range(k, 0, -1):
	if b % 2 == 0:
		solution.append(solution[a - 1] + i)
	else:
		solution.append(solution[a - 1] - i)
	a += 1
	b += 1
for i in range(k + 2, n + 1):
	solution.append(i)
print(' '.join(map(str, solution)))


import math
(a, b) = map(int, input().split())
x1 = list(range(1, math.ceil(a / 2) + 1))
x2 = list(range(math.ceil(a / 2) + 1, a + 1))
x2 = x2[::-1]
r = []
for i in range(b):
	if i % 2 == 0:
		r.append(x1.pop(0))
	else:
		r.append(x2.pop(0))
x = x1 + x2
x.sort()
if r[-1] > max(x):
	r += x[::-1]
else:
	r += x
print(' '.join(map(str, r)))


(n, k) = [int(i) for i in input().split()]
r = 1
k1 = k + 1
for i in range(k + 1):
	if i % 2 == 0:
		print(r, end=' ')
		r += 1
	else:
		print(k1, end=' ')
		k1 -= 1
for i in range(k + 2, n + 1):
	print(i, end=' ')


(n, k) = map(int, input().split())
diff = n - 1
current = 1
print(current, end=' ')
for i in range(k - 1):
	current += (-1) ** (i % 2) * diff
	diff -= 1
	print(current, end=' ')
for i in range(n - k):
	current += (-1) ** ((k + 1) % 2)
	print(current, end=' ')
print()


params = list(map(int, list(input().split())))
n = params[0]
k = params[1]

def do_shit():
	lst = [1, k + 1]
	count = 2
	while len(lst) <= n:
		lst.append(count)
		if abs(lst[-1] - lst[-2]) == 1:
			break
		lst.append(k - count + 2)
		if abs(lst[-1] - lst[-2]) == 1:
			break
		count += 1
	for r in range(len(lst) + 1, n + 1):
		lst.append(r)
	return lst
if k == 1:
	string = ''
	for r in range(1, n + 1):
		string += str(r)
		string += ' '
	print(string[:-1])
else:
	lst = do_shit()
	string = ''
	for i in lst:
		string += str(i)
		string += ' '
	print(string[:-1])


(n, k) = map(int, input().split())
l = []
i = 1
j = n
c = k
x = 0
while i <= j:
	if x % 2 == 0:
		l.append(i)
		i += 1
		x += 1
		c -= 1
		if c <= 0:
			break
	elif x % 2 == 1:
		l.append(j)
		j -= 1
		x += 1
		c -= 1
		if c <= 0:
			break
if k % 2 == 0:
	for h in range(j, i - 1, -1):
		l.append(h)
else:
	for h in range(i, j + 1):
		l.append(h)
print(*l)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = 1
for _ in range(testcases):
	(n, k) = vary(2)
	temp = k
	num = [i for i in range(1, n + 1)]
	j = 0
	for i in range(k + 1):
		if i % 2 == 0:
			print(num[j], end=' ')
			j += 1
		else:
			print(num[k], end=' ')
			k -= 1
	for i in range(temp + 1, n):
		print(num[i], end=' ')


(n, k) = map(int, input().split())
ans = [1]
L = [i for i in range(k, 0, -1)]
adds = set([1])
rems = set([i for i in range(2, n + 1)])
flg = True
for l in L:
	if flg:
		tmp = ans[-1] + l
	else:
		tmp = ans[-1] - l
	ans.append(tmp)
	rems.remove(tmp)
	flg = not flg
rems = list(rems)
rems.sort()
for rem in rems:
	ans.append(rem)
print(' '.join(map(str, ans)))


f = input()
(n, k) = map(int, f.split(' '))
x = n
y = 1
for i in range(k):
	if i % 2 == 0:
		print(x, end=' ')
		x -= 1
	else:
		print(y, end=' ')
		y += 1
bas = 0
t = 0
if k % 2 == 0:
	bas = y
	t = 1
else:
	bas = x
	t = -1
for i in range(n - k):
	print(bas, end=' ')
	bas += t


from __future__ import print_function
s = input().split()
n = int(s[0])
k = int(s[1])
a = 1
b = k + 1
i = 0
while a < b:
	print(a, end=' ')
	a += 1
	print(b, end=' ')
	b -= 1
if a == b:
	print(a, end=' ')
i = 2 + k
while i <= n:
	print(i, end=' ')
	i += 1


import sys, math
(n, k) = map(int, input().split(' '))
arr = [None] * n
even = 1
odd = n
for i in range(n):
	if i % 2 == 0:
		arr[i] = even
		even += 1
	else:
		arr[i] = odd
		odd -= 1
minn = min(arr[k - 1:])
if arr[k - 1] > minn:
	num = arr[k - 1]
	for i in range(k - 1, n):
		arr[i] = num
		num -= 1
else:
	num = arr[k - 1]
	for i in range(k - 1, n):
		arr[i] = num
		num += 1
arr = map(str, arr)
print(' '.join(arr))


(n, k) = map(int, input().split())
cur1 = 1
cur2 = n
temp = 0
tt = 0
for i in range(n):
	if i < k:
		if i & 1 == 0:
			print(cur1, end=' ')
			cur1 += 1
			temp = cur1
			tt = 1
		else:
			print(cur2, end=' ')
			cur2 -= 1
			temp = cur2
			tt = -1
	elif tt == 1:
		print(cur1, end=' ')
		cur1 += 1
	else:
		print(cur2, end=' ')
		cur2 -= 1
print()


(n, k) = map(int, input().split())
a = list(range(1, n + 1))
for i in range(1, k + 1):
	a[i] = a[i - 1] + (k - i + 1 if i & 1 else i - k - 1)
print(' '.join((repr(x) for x in a)))


import sys
(n, k) = map(int, sys.stdin.readline().split())
if k % 2 == 0:
	t = k // 2
	ans = []
	for i in range(1, t + 1):
		ans.append(i)
		ans.append(n + 1 - i)
	for i in range(n - t, t, -1):
		ans.append(i)
else:
	t = k // 2
	ans = []
	for i in range(1, t + 1):
		ans.append(i)
		ans.append(n + 1 - i)
	for i in range(t + 1, n - t + 1):
		ans.append(i)
print(' '.join([str(i) for i in ans]))


(n, k) = map(int, input().split())
l = [int(i) for i in range(1, n + 1)]
j = 1
x = []
i = 1
inc = 1
dec = n
if k == 1:
	for i in range(n):
		print(i + 1, end=' ')
else:
	while len(x) < n:
		if i % 2 != 0:
			x.append(inc)
			inc += 1
		else:
			x.append(dec)
			dec -= 1
		i += 1
	ans = x[:k]
	if ans[len(ans) - 1] < ans[len(ans) - 2]:
		for i in range(ans[len(ans) - 1] + 1, ans[len(ans) - 2]):
			ans.append(i)
	else:
		for i in range(ans[len(ans) - 1] - 1, ans[len(ans) - 2], -1):
			ans.append(i)
	for i in range(len(ans)):
		print(ans[i], end=' ')


entrada = input()
entrada_str = list(entrada.split(' '))
entrada_int = list(map(int, entrada_str))
tamanho = entrada_int[0]
p = entrada_int[1]
numero_anterior = 0
for i in range(1, p + 2):
	if i == 1:
		numero_atual = 1
	elif i % 2 == 0:
		numero_atual = p + 2 - numero_anterior
	else:
		numero_atual = p + 3 - numero_anterior
	print(numero_atual, end=' ')
	numero_anterior = numero_atual
for i in range(p + 2, tamanho + 1):
	print(i)


(n, k) = map(int, input().strip().split())
a = b = k // 2 + 1
delta = (k & 1) * 2 - 1
res = []
for i in range(k // 2):
	res.append(a)
	a -= delta
	b += delta
	res.append(b)
if k & 1:
	res.append(a)
for a in range(k + 1, n + 1):
	res.append(a)
print(*res)


(n, k) = map(int, input().split(' '))
o = n - k
print(1, end=' ')
for i in range(2, o + 1):
	print(i, end=' ')
mb = n
mm = o + 1
while mb >= mm:
	print(mb, end=' ')
	mb -= 1
	if mb >= mm:
		print(mm, end=' ')
		mm += 1


entrada = input()
n = int(entrada.split()[0])
k = int(entrada.split()[1])
cc = n - k
flag = 1
i = 1
while i <= n - k:
	print(i, end=' ')
	i += 1
i = k
while i >= 1:
	if flag == 1:
		if i == 1:
			print(cc + i)
		else:
			print(cc + i, end=' ')
		cc += i
		flag = 0
	else:
		if i == 1:
			print(cc - i)
		else:
			print(cc - i, end=' ')
		cc -= i
		flag = 1
	i -= 1


__author__ = 'neki'
import sys
words = input().split()
n = int(words[0])
k = int(words[1])
perm = [1]
viz = [0 for x in range(n + 1)]
viz[1] = 1
dif = k
one = 1
while dif > 0:
	num = perm[len(perm) - 1] + one * dif
	perm.append(num)
	viz[num] = 1
	one *= -1
	dif -= 1
for i in range(1, n + 1):
	if viz[i] == 0:
		perm.append(i)
for i in range(n - 1):
	print(perm[i], end=' ')
print(perm[n - 1])


import time, math, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

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

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count

def solve():
	(n, k) = IP()
	d = {}
	for i in range(1, n + 1):
		d[i] = 1
	li = [1]
	d[1] = 0
	for i in range(k, 0, -1):
		if d.get(li[-1] - i, 0) == 1:
			li.append(li[-1] - i)
			d[li[-2] - i] = 0
		elif d.get(li[-1] + i, 0) == 1:
			li.append(li[-1] + i)
			d[li[-2] + i] = 0
	for ele in d:
		if d[ele] == 1:
			li.append(ele)
	print(*li)
solve()


from __future__ import nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals
import sys, os, time
import itertools

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

def rl(n):
	return [list(map(int, input().split())) for _ in range(n)]
if os.path.exists('test.txt'):
	sys.stdin = open('test.txt')

def works(perm, k):
	return len(set([abs(perm[i + 1] - perm[i]) for i in range(len(perm) - 1)])) == k

def solve(n, k):
	l = [i for i in range(1, n + 1)]
	res = [1]
	up = 1
	for i in range(k, 0, -1):
		res.append(res[-1] + i * up)
		up *= -1
	there = set(res)
	for i in range(1, n + 1):
		if i not in there:
			res.append(i)
	print(' '.join(map(str, res)))
(n, k) = rv()
solve(n, k)


(n, k) = map(int, input().split())
l = [1]
c = 0
for i in range(k, 1, -1):
	if c % 2 == 0:
		l.append(l[-1] + i)
	if c % 2 == 1:
		l.append(l[-1] - i)
	c += 1
s = sorted(set(range(1, n + 1)).difference(set(l)))
l.extend(s)
print(*l)


from sys import stdin, stdout
import math, collections
mod = 998244353

def swap(arr, i, j):
	(arr[i], arr[j]) = (arr[j], arr[i])
(n, k) = map(int, stdin.readline().split())
arr = [1]
s = set()
i = 1
while len(s) < k - 1:
	if len(arr) % 2 == 1:
		arr.append(n - i // 2)
	else:
		arr.append(i // 2 + 1)
	s.add(abs(arr[-2] - arr[-1]))
	i += 1
if len(arr) % 2 == 0:
	while len(arr) < n:
		arr.append(arr[-1] - 1)
else:
	while len(arr) < n:
		arr.append(arr[-1] + 1)
print(*arr)


r = list(map(int, input().split()))
n = r[0]
k = r[1]
l = list()
l.append(1)
c = k
justI = 0
maxl = 0
previous = 1
print(1, end=' ')
for i in range(1, n):
	if justI == 1:
		print(maxl + 1, end=' ')
		maxl += 1
	else:
		print(previous + c, end=' ')
		previous = previous + c
		if previous > maxl:
			maxl = previous
		if c > 1:
			c -= 1
			c *= -1
		elif c < -1:
			c += 1
			c *= -1
		else:
			justI = 1


from itertools import permutations

def main():
	(n, k) = map(int, input().strip().split())
	a = b = k // 2 + 1
	delta = (k & 1) * 2 - 1
	res = []
	for _ in range(k // 2):
		res.append(a)
		a -= delta
		b += delta
		res.append(b)
	if k & 1:
		res.append(a)
	for a in range(k + 1, n + 1):
		res.append(a)
	print(*res)
main()


(n, k) = map(int, input().split())
a = []
k += 1
one = 0
two = 0
f = False
for i in range(1, n + 1):
	if i % 2 != 0:
		i -= one
		a.append(i)
		one += 1
	else:
		i -= two
		a.append(n + 2 - i)
		two += 1
	k -= 1
	if k == 1:
		f = True
		d = set(a)
		if len(a) % 2 == 0:
			for j in range(n - 1, 0, -1):
				if j not in d:
					a.append(j)
		else:
			for j in range(1, n + 1):
				if j not in d:
					a.append(j)
	if f:
		break
print(*a)


(n, k) = map(int, input().split())
(p, q) = (1, n)
rest = list()
for i in range(k):
	if i % 2 == 0:
		rest.append(p)
		p += 1
	else:
		rest.append(q)
		q -= 1
if k % 2 == 0:
	for i in range(q, p - 1, -1):
		rest.append(i)
else:
	for i in range(p, q + 1):
		rest.append(i)
print(' '.join(map(str, rest)))


def printList(a):
	print(' '.join(map(str, a)))

def solve():
	(n, k) = map(int, input().split())
	if k == 1:
		printList(range(1, n + 1))
		return
	cur = k + 1
	sh = k
	sg = -1
	ans = []
	while True:
		ans.append(cur)
		cur += sh * sg
		if not sh:
			break
		sh -= 1
		sg *= -1
	ans += list(range(k + 2, n + 1))
	printList(ans)
solve()


(a, b) = map(int, input().split())
i = 1
j = 1 + b
n = 0
while i <= j:
	if n == 0:
		print(i, end=' ')
		i += 1
		n ^= 1
	else:
		print(j, end=' ')
		j -= 1
		n ^= 1
print(*[*range(2 + b, a + 1)])


(n, k) = list(map(int, input().split()))
d = []
for i in range(1, n + 1):
	d.append(i)
b = []
(l, r) = (0, n - 1)
k -= 1
i = 0
while l <= r:
	if k != 0:
		if k % 2 == 0:
			b.append(d[l])
			l += 1
			k -= 1
		else:
			b.append(d[r])
			r -= 1
			k -= 1
	else:
		b.append(d[l])
		l += 1
	i += 1
for i in b:
	print(i, end=' ')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	(n, k) = LI()
	l = 1
	r = n
	lf = 1
	rr = []
	while l <= r:
		if k == 1:
			if lf:
				rr.append(l)
				l += 1
			else:
				rr.append(r)
				r -= 1
			continue
		if lf:
			rr.append(l)
			l += 1
		else:
			rr.append(r)
			r -= 1
		lf ^= 1
		k -= 1
	return JA(rr, ' ')
print(main())


(n, k) = map(int, input().split())
l_n = list()
h = n
l = 1
for i in range(n):
	if i < k:
		if i % 2 == 0:
			l_n.append(i // 2 + 1)
			l = i // 2 + 1
		else:
			l_n.append(n - i // 2)
			h = n - i // 2
	else:
		if i % 2 == 1:
			l_n.extend((l + x for x in range(1, n + 1 - i)))
		if i % 2 == 0:
			l_n.extend((h - x for x in range(1, n + 1 - i)))
		break
print(' '.join((str(x) for x in l_n)))


from fileinput import *
for line in input():
	if lineno() == 1:
		[n, k] = list(map(int, line.split()))
a = [i + 1 for i in range(n)]
b = a[:k + 1]
bend = a[k + 1:]
lb = len(b)
if lb % 2 == 1:
	middle = lb // 2 + 1
else:
	middle = lb // 2
(b[::2], b[1::2]) = (b[:middle], b[:middle - 1:-1])
answer = b + bend
s = ''.join([str(x) + ' ' for x in answer])
print(s.strip())


(a, b) = list(map(int, input().split()))
c = []
(d, e) = (1, b + 1)
while e > d:
	c += [d, e]
	e -= 1
	d += 1
if e == d:
	c.append(e)
print(' '.join(map(str, c + list(range(b + 2, a + 1)))))


import sys
import math
(n, k) = [int(x) for x in sys.stdin.readline().split()]
res = []
z = 1
for i in range(n, 1, -1):
	if i > k:
		res.append(str(i))
	else:
		z = i
		break
l = z
j = 1
for i in range(1, z + 1):
	if i % 2 != 0:
		res.append(str(j))
		j += 1
	else:
		res.append(str(z))
		z -= 1
print(' '.join(res[::-1]))


import sys
(n, k) = map(int, input().split())
if k == 1:
	for i in range(1, n + 1):
		print(i, end=' ')
	sys.exit()
for i in range(0, k // 2):
	print(i + 1, n - i, end=' ')
if k % 2:
	z = k // 2 + 3
	for i in range(n - k // 2, k // 2 + 2, -1):
		z = i
		print(i, end=' ')
	print(z - 2, z - 1)
else:
	for i in range(n - k // 2, k // 2, -1):
		print(i, end=' ')


a = input()
a = a.split()
b = [0] * int(a[0])
f = []
mensaje = ' '
mensaje1 = ''
z = 0
nana = 0
if int(a[1]) == 1:
	for p in range(int(a[0])):
		b[p] = str(p + 1)
	mensaje1 = ' '.join(b)
else:
	n1 = 1
	nm = int(a[1]) + 1
	ku = 0
	while ku < int(a[1]) + 1:
		if ku % 2 == 0:
			f.append(str(nm))
			nm = nm - 1
		else:
			f.append(str(n1))
			n1 = n1 + 1
		ku = ku + 1
	for k in range(int(a[1]) + 2, int(a[0]) + 1):
		f.append(str(k))
	mensaje1 = ' '.join(f)
print(mensaje1)


(n, m) = map(int, input().split())
l = [1]
m = m - 1
s = n
p = 2
while m > 0:
	l.append(s)
	m = m - 1
	s = s - 1
	if m > 0:
		l.append(p)
		m = m - 1
		p = p + 1
if l[len(l) - 1] - p == -1:
	z = p
	c = 1
else:
	z = s
	c = 2
while len(l) != n:
	if c == 1:
		l.append(z)
		z = z + 1
	else:
		l.append(z)
		z = z - 1
print(*l)


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


a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
n = a[0]
k = a[1]
j = 0
q = n
w = n - k + 1
for i in range(n - k):
	print(i + 1)
for i in range(k):
	if not i % 2:
		print(q)
		q = q - 1
	else:
		print(w)
		w = w + 1


s = input()
arr = s.split()
n = int(arr[0])
k = int(arr[1])
print(1, end='')
i = 2
while i in range(2, k + 1):
	if i % 2 == 0:
		print('', n - i // 2 + 1, end='')
	else:
		print('', (i + 1) // 2, end='')
	i = i + 1
if k % 2 == 0:
	x = n - k // 2
	i = k
	while i in range(k, n):
		print('', x, end='')
		x = x - 1
		i = i + 1
else:
	x = (k + 1) // 2 + 1
	i = k
	while i in range(k, n):
		print('', x, end='')
		x = x + 1
		i = i + 1
print()


(n, k) = map(int, input().split())
a = [q for q in range(1, n + 1)]
h = n - k - 1
for q in range(h):
	print(a[q], end=' ')
(l, r) = (h, n - 1)
while l < r:
	print(a[l], a[r], end=' ')
	l += 1
	r -= 1
if l == r:
	print(a[l])


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, k) = value()
a = [i for i in range(1, n + 1)]
ans = []
l = 0
r = n - 1
while l < r:
	ans.append(a[l])
	ans.append(a[r])
	l += 1
	r -= 1
if l <= r:
	ans.append(a[l])
ans = ans[:k]
if k % 2:
	ans += a[k // 2 + 1:k // 2 + 1 + n - k]
else:
	ans += a[k // 2:k // 2 + n - k][::-1]
print(*ans)


(n, k) = map(int, list(input().split()))
for i in range(1, (k + 3) // 2):
	print(i, k + 2 - i, end=' ')
if k > 1 and k % 2 == 0:
	print(k // 2 + 1, end=' ')
for i in range(k + 2, n + 1):
	print(i, end=' ')


entry = input().split()
p = int(entry[0])
k = int(entry[1])
forward = 1
backward = k + 1
answer = []
for controller in range(k // 2 + 1):
	answer.append(str(forward))
	if forward != backward:
		answer.append(str(backward))
	forward += 1
	backward -= 1
for filler in range(k + 2, p + 1):
	answer.append(str(filler))
print(' '.join(answer))


(n, k) = map(int, input().split())
x = 0
a0 = k + 2
a1 = 0
for i in range(k + 1):
	if i % 2 == 0:
		a1 += 1
		print(a1, end=' ')
	else:
		a0 -= 1
		print(a0, end=' ')
for i in range(k + 2, n + 1):
	print(i, end=' ')


s = input().split()
n = int(s[0])
k = int(s[1])
max = k + 1
l = 1
print(l, end=' ')
for i in range(k):
	if i % 2 == 0:
		l += k
	else:
		l -= k
	k -= 1
	print(l, end=' ')
if max < n:
	for i in range(max + 1, n + 1):
		print(i, end=' ')


(n, k) = list(map(int, input().split()))
cn = 0
pn = 0
for i in range(1, k + 2):
	if i == 1:
		cn = 1
	else:
		cn = k - pn + 2 + i % 2
	print(cn, end=' ')
	pn = cn
for i in range(k + 2, n + 1):
	print(i, end=' ')


def main():
	(n, k) = map(int, input().split())
	res = [1]
	visited = {1}
	j = 0
	for i in range(k, 0, -1):
		res.append(res[-1] + i if j % 2 == 0 else res[-1] - i)
		visited.add(res[-1])
		j += 1
	for i in range(1, n + 1):
		if i not in visited:
			res.append(i)
	print(*res)
main()


int_inp = lambda : int(input())
strng = lambda : input().strip()
strl = lambda : list(input().strip())
mul = lambda : map(int, input().split())
mulf = lambda : map(float, input().split())
seq = lambda : list(map(int, input().split()))
import math
from collections import Counter, defaultdict
(k, m) = mul()
a = [0] * k
q = 1
print(1, end=' ')
i = 1
for i in range(1, m + 1):
	q += m
	print(q, end=' ')
	if m > 0:
		m = -(m - 1)
	else:
		m = -(m + 1)
	i += 1
while i < k:
	print(i + 1, end=' ')
	i += 1


(n, k) = [int(g) for g in input().split()]
num = list(range(n + 1))
del num[0]
s = ''
for i in range(n - k):
	s += str(num[i])
	s += ' '
f = n - k
r = n - 1
i = 0
while r >= f:
	if i % 2 == 0:
		s += str(num[r])
		s += ' '
		r -= 1
	if i % 2 != 0:
		s += str(num[f])
		s += ' '
		f += 1
	i += 1
print(s)


import itertools
import math

def main():
	(n, k) = map(int, input().split())
	a = 1
	b = n
	res = []
	for i in range(k - 1):
		if i % 2:
			res.append(a)
			a += 1
		else:
			res.append(b)
			b -= 1
	if k % 2:
		res += range(b, a - 1, -1)
	else:
		res += range(a, b + 1)
	print(' '.join(map(str, res)))
main()


from fractions import gcd
[n, k] = [int(s) for s in input().split()]
sign = 1
p = [0 for i in range(n)]
kk = k
p[0] = 1
i = 0
while kk > 0:
	p[i + 1] = p[i] + sign * kk
	i = i + 1
	sign = -sign
	kk = kk - 1
i = i + 1
if i < n:
	p[i] = k + 2
while i < n - 1:
	p[i + 1] = p[i] + 1
	i = i + 1
print(' '.join(map(str, p)))


s = input()
n = int(s.split()[0])
k = range(int(s.split()[1]), 0, -1)
a = int(1)
f = int(1)
for i in k:
	print(a)
	a += i * f
	f = -f
print(a)
a = k[0] + 1
for i in range(n - int(s.split()[1]) - 1):
	a += 1
	print(a)


import collections
(n, k) = map(int, input().split())
d = collections.deque()
for i in range(1, n + 1):
	d.append(i)
res = []
turn = 0
while k > 1:
	if turn == 0:
		res.append(d.popleft())
	else:
		res.append(d.pop())
	turn = 1 - turn
	k -= 1
if turn == 1:
	while d:
		res.append(d.pop())
else:
	while d:
		res.append(d.popleft())
print(*res)


def getLine():
	return list(map(int, input().split()))
(n, k) = getLine()
l = [0] * n
for i in range(n):
	if i % 2 == 0:
		l[i] = i // 2 + 1
	else:
		l[i] = n - l[i - 1] + 1
ans = l
for i in range(k, n):
	if k % 2 == 0:
		l[i] = l[i - 1] - 1
	else:
		l[i] = l[i - 1] + 1
for i in ans:
	print(i, end=' ')


def arr_inp():
	return [int(x) for x in stdin.readline().split()]
from sys import stdin
from collections import *
(n, k) = arr_inp()
(ans, mem, c) = ([], defaultdict(int), 0)
for i in range(n - k):
	ans.append(i + 1)
	mem[i + 1] = 1
for i in range(k, 0, -1):
	ix = ans[-1]
	if c & 1:
		ix -= i
	else:
		ix += i
	if mem[ix] == 0:
		mem[ix] = 1
		ans.append(ix)
	c += 1
print(*ans)


(n, k) = map(int, input().split())
t = []
t.append(1)
h = 1
p = 0
for i in range(k, 0, -1):
	if p % 2 == 0:
		o = t[h - 1] + i
		p += 1
		t.append(o)
		h += 1
	else:
		t.append(t[h - 1] - i)
		h += 1
		p += 1
for i in range(k + 2, n + 1):
	t.append(i)
for i in t:
	print(i, end=' ')


(n, k) = map(int, input().split())
b = ''
i = 1
j = n
c = 0
p = 0
while p < n:
	if c < k:
		if p % 2 == 0:
			b += str(i) + ' '
			i += 1
			c += 1
		else:
			b += str(j) + ' '
			j -= 1
			c += 1
	elif p % 2 == 1:
		for q in range(i, j + 1):
			b += str(q) + ' '
		print(b)
		exit(0)
	else:
		for q in range(j, i - 1, -1):
			b += str(q) + ' '
		print(b)
		exit(0)
	p += 1
print(b)


def main():
	from sys import stdin, stdout
	(n, k) = map(int, stdin.readline().strip().split(' '))
	p = []
	for i in range(n - k):
		p.append(i + 1)
	l = n - k + 1
	o = n
	x = False
	for i in range(n - k + 1, n + 1):
		if x:
			p.append(l)
			l += 1
		else:
			p.append(o)
			o -= 1
		x ^= True
	stdout.write(' '.join(list(map(str, p))) + '\n')
main()


(n, k) = map(int, input().split())
lista = []
anterior = 0
for j in range(1, k + 2):
	if j == 1:
		valor = 1
	else:
		valor = k + 2 - anterior if j % 2 == 0 else k + 3 - anterior
	lista.append(valor)
	anterior = valor
for j in range(k + 2, n + 1):
	lista.append(j)
for n in lista:
	print(n)


(n, k) = list(map(int, input().split()))
ar = [i + 1 for i in range(n)]
if k == 1:
	print(' '.join(map(str, ar)))
else:
	shuffle = ar[:k + 1]
	r = len(shuffle) - 1
	l = 0
	ans = []
	t = 'r'
	while l != r:
		if t == 'r':
			ans.append(shuffle[r])
			r -= 1
			t = 'l'
		else:
			ans.append(shuffle[l])
			t = 'r'
			l += 1
	ans.append(shuffle[l])
	ans = ans + ar[k + 1:]
	print(' '.join(map(str, ans)))


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


(n, k) = [int(i) for i in input().split()]
if k == 2:
	print(1, 3, 2, end=' ')
	for i in range(4, n + 1):
		print(i, end=' ')
elif k % 2 == 0:
	low = 1
	high = n
	for i in range(k - 1):
		if i % 2 == 1:
			print(low, end=' ')
			low += 1
		else:
			print(high, end=' ')
			high -= 1
	for i in range(low, high + 1):
		print(i, end=' ')
else:
	low = 1
	high = n
	for i in range(k - 1):
		if i % 2 == 0:
			print(low, end=' ')
			low += 1
		else:
			print(high, end=' ')
			high -= 1
	for i in range(low, high + 1):
		print(i, end=' ')
print()


arr = [int(x) for x in input().split()]
n = arr[0]
k = arr[1]
c = n - k
flag = True
resp = []
for i in range(1, n - k + 1):
	resp.append(str(i))
for i in range(k, 0, -1):
	if flag:
		c += i
		resp.append(str(c))
		flag = False
	else:
		c -= i
		resp.append(str(c))
		flag = True
resp = ' '.join(resp)
print(resp)


(n, k) = map(int, input().split())
L = []
for i in range(n + 1):
	L.append(i)
k1 = k
s = n * (n + 1) / 2 - 1
L[1] = 0
L[k + 1] = 0
print('1', k + 1, end=' ')
k = k - 1
b = k + 2
while s > 0:
	if k == 0:
		break
	if b - k > 0 and L[b - k] != 0:
		print(L[b - k], end=' ')
		L[b - k] = 0
		s -= b - k
		b = abs(b - k)
		k -= 1
	else:
		print(L[b + k], end=' ')
		L[b + k] = 0
		s -= b + k
		b = abs(b + k)
		k -= 1
for i in range(len(L)):
	if L[i] != 0:
		print(L[i], end=' ')


l2 = input().split()
x = int(l2[0])
y = int(l2[1])
c = x - y
d = True
for i in range(1, x - y + 1):
	print(str(i) + ' ', end='')
v = y
while v >= 1:
	if d:
		print(str(c + v) + ' ', end='')
		c += v
		d = False
	else:
		print(str(c - v) + ' ', end='')
		c -= v
		d = True
	v -= 1


maxn = 100000 + 10
ans = [0 for i in range(maxn)]
vis = [0 for i in range(maxn)]
s = input()
arr = s.split()
n = int(arr[0])
k = int(arr[1])
ans[0] = 1
cnt = k
for i in range(1, k + 1):
	tmp = ans[i - 1] + cnt
	if tmp > k + 1 or vis[tmp] == 1:
		tmp = ans[i - 1] - cnt
	vis[tmp] = 1
	ans[i] = tmp
	cnt -= 1
print(1, end='')
for i in range(1, k + 1):
	print('', ans[i], end='')
for i in range(k + 1, n):
	print('', i + 1, end='')
print()


(n, k) = input().split()
(n, k) = (int(n), int(k))
sequence = []
digitos = []
prox_asc = 1
prox_desc = k + 1
turno = False
for _ in range(k + 1):
	digitos.append(abs(prox_asc - prox_desc))
	if turno:
		sequence.append(prox_desc)
		prox_desc -= 1
	else:
		sequence.append(prox_asc)
		prox_asc += 1
	turno = not turno
for i in range(k + 2, n + 1):
	sequence.append(i)
print(' '.join([str(x) for x in sequence]))


from functools import lru_cache
from sys import stderr
INF = 10 ** 18 + 3
EPS = 1e-10

def res_to_stderr(function):

	def wrapped(*args, **kwargs):
		res = function(*args, **kwargs)
		print(res, file=stderr)
		return res
	return wrapped

@res_to_stderr
def range_of_len(start, length, step=1):
	return range(start, start + length * step, step)

@lru_cache(10 ** 9)
def find_perm(length, n_different):
	if length == 0:
		return []
	if n_different != length - 1:
		return list(range_of_len(length, length - n_different - 1, -1)) + find_perm(n_different + 1, n_different)
	curr = length
	go_down = True
	res = []
	for _ in range(n_different + 1):
		res.append(curr)
		curr = length - curr + go_down
		go_down ^= True
	return res

def main():
	(n, k) = map(int, input().split())
	print(*find_perm(n, k))
main()


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


def main():
	(n, k) = map(int, input().split())
	first = 1
	last = n
	ans = []
	k -= 1
	if k == 0:
		while first <= last:
			ans.append(first)
			first += 1
		for i in ans:
			print(i, end=' ')
		return
	ans = [1]
	first += 1
	count = 0
	while count != k:
		if count % 2 == 0:
			ans.append(last)
			last -= 1
		else:
			ans.append(first)
			first += 1
		count += 1
	if ans[-1] <= n // 2:
		while len(ans) != n:
			ans.append(ans[-1] + 1)
	else:
		while len(ans) != n:
			ans.append(ans[-1] - 1)
	for i in ans:
		print(i, end=' ')
main()


from sys import stdin
lines = list(filter(None, stdin.read().split('\n')))

def parseline(line):
	return list(map(int, line.split()))
lines = list(map(parseline, lines))
(n, k) = lines[0]
x = n + 1
for i in range(n, n - k, -1):
	if (n - i) % 2 == 0:
		x = x - i
	else:
		x = x + i
	print(x, end=' ')
step = -1 if k % 2 == 0 else +1
for k in range(n - k):
	x += step
	print(x, end=' ')


(n, k) = input().split()
answer = []
answer.append(1)
appendVar = 1
lowVar = 2
highVar = 1 + int(k)
for i in range(1, int(k) + 1):
	if i % 2 == 1:
		appendVar = highVar
		highVar -= 1
		answer.append(appendVar)
	else:
		appendVar = lowVar
		lowVar += 1
		answer.append(appendVar)
for i in range(int(k) + 2, int(n) + 1):
	answer.append(i)
print(*answer)


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, k) = value()
a = [0] * n
ind = 0
ele = 1
done = 0
for i in range(ceil(n / 2)):
	a[ind] = ele
	try:
		a[ind + 1] = n - ele + 1
	except:
		pass
	ind += 2
	ele += 1
a = a[:k]
over = set(a)
last = a[k - 1]
while len(a) != n:
	if a[-1] + 1 not in over and a[-1] + 1 <= n:
		over.add(a[-1] + 1)
		a.append(a[-1] + 1)
	else:
		over.add(a[-1] - 1)
		a.append(a[-1] - 1)
print(*a)


(n, k) = map(int, input().split())
a = [x + 1 for x in range(n)]
l = 0
r = n - 1
p = 0
for i in range(k - 1):
	if p:
		print(a[r], end=' ')
		r -= 1
		p = not p
	else:
		print(a[l], end=' ')
		l += 1
		p = not p
p = not p
if p:
	for i in range(l, r + 1):
		print(a[i], end=' ')
else:
	for i in range(r, l - 1, -1):
		print(a[i], end=' ')


(n, k) = map(int, input().split())
t = list(range(1, n + 1))
if k > 1:
	j = 0
	for i in range((k + 1) // 2):
		t[j] = k - i + 1
		t[j + 1] = i + 1
		j += 2
	if not k & 1:
		t[j] = k // 2 + 1
print(' '.join(map(str, t)))


from sys import stdin, stdout
input = stdin.readline
(n, k) = map(int, input().split())

def f(n):
	n += 1
	l = []
	for i in range(1, 1 + n // 2):
		l.append(str(i))
		l.append(str(n - i + 1))
	if n % 2 == 1:
		l.append(str(n // 2 + 1))
	return l
ans = f(k)
for i in range(n - k - 1):
	ans.append(str(i + k + 2))
stdout.write(' '.join(ans))


(n, k) = map(int, input().split())
sign = 1
res = [1]
res_end = list(range(2 + k, n + 1))
while k > 0:
	res += [res[-1] + sign * k]
	sign = -1 * sign
	k -= 1
print(' '.join(map(str, res + res_end)))


(n, k) = map(int, input().split())
for i in range(1, n - k + 1):
	print(i, end=' ')
i += 1
while i < n:
	print(n, i, end=' ')
	i += 1
	n -= 1
if i == n:
	print(n, end=' ')
print()


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


import sys

def solve():
	r = list(map(int, input().split()))
	n = r[0]
	k = r[1]
	l = list()
	l.append(1)
	c = k
	justI = 0
	maxsofar = 1
	for i in range(1, n):
		if justI == 1:
			l.append(maxsofar + 1)
			maxsofar += 1
		else:
			l.append(l[i - 1] + c)
			maxsofar = max(maxsofar, l[i - 1] + c)
			if c > 1:
				c -= 1
				c *= -1
			elif c < -1:
				c += 1
				c *= -1
			else:
				justI = 1
	return l

def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return list(map(int, inputs.split()))

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	if isinstance(s, tuple):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')

def run():
	if sys.hexversion == 50594544:
		sys.stdin = open('test.txt')
	res = solve()
	write(res)
run()


import math
(n, k) = [int(x) for x in input().split()]
number = math.ceil((k + 1) / 2)
for i in range(k + 1):
	if k % 2 == 1 and i % 2 == 1 or (k % 2 == 0 and i % 2 == 0):
		number += i
	else:
		number -= i
	print(f'{number} ', end='')
for i in range(k + 2, n + 1):
	print(f'{i} ', end='')
print()


(n, k) = map(int, input().strip().split(' '))
if n == 1:
	print(1)
elif n == 2:
	print('1 2')
elif k == 1:
	for i in range(1, n + 1):
		print(i, end=' ')
	print()
elif k == n - 1:
	i1 = 1
	i2 = n
	for i in range(1, n + 1):
		if i % 2 != 0:
			print(i1, end=' ')
			i1 += 1
		else:
			print(i2, end=' ')
			i2 -= 1
else:
	for i in range(1, n - k):
		print(i, end=' ')
	i1 = i + 1
	i2 = n
	for j in range(1, k + 2):
		if j % 2 != 0:
			print(i1, end=' ')
			i1 += 1
		else:
			print(i2, end=' ')
			i2 -= 1