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.

Difficulty: competition

Starter code:

Solutions:
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()

import itertools
import math

def main():
	n, k = list(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 += list(range(b, a - 1, -1))
	else:
		res += list(range(a, b + 1))
			
	print(" ".join(map(str, res)))

def __starting_point():
	main()

__starting_point()

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

def solve():
    n, k = list(map(int, input().split()))
    if k == 1:
        printList(list(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()


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)))


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 = ' ')

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()





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:
        #l.append(max(l)+1)
        print(maxl+1, end=' ')
        maxl += 1
    else:
        # l.append(l[i-1]+c)
        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
# for i in l:
#     print(i, end=" ")




#10 4
#1 5 2 4 3 6 7 8 9 10

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 = [int(x) for x in input().split()]
ans = []
for i in range(k):
	if i % 2:
		ans.append(str(n - i // 2))
	else:
		ans.append(str(i // 2 + 1))
for i in range(n - k):
	if k % 2:
		ans.append(str(k // 2 + 2 + i))
	else:
		ans.append(str(n - k // 2 - i))
print(' '.join(ans))


import sys
import math
  
n, k = [int(x) for x in (sys.stdin.readline()).split()]
res = []

if(k == 1):
    for i in range(1, n + 1):
        res.append(str(i))
    print(" ".join(res))
    return

z = n
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
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]))

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()

def main():
    n, k = list(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())
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)))

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:
        #l.append(max(l)+1)
        print(maxl+1, end=' ')
        maxl += 1
    else:
        # l.append(l[i-1]+c)
        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

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  # String
    if mode == 1: return inputs.split()  # List of strings
    if mode == 2: return list(map(int, inputs.split()))  # List of integers
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 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  # String
    if mode == 1: return inputs.split()  # List of strings
    if mode == 2: return list(map(int, inputs.split()))  # List of integers
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()

# coding: utf-8
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))


# python3
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:
	# k = 2, +2 -1: 1 3 2
	# k = 3, +3 -2 + 1: 1 4 2 3 
	# k = 4, +4 -3 + 2 -1: 1 5 2 4 3 
	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)


	# for z in range((k+1)/2):
	# 	# Difference continues to decrease by 1
	# 	print(diff + z, end=" ") 
	# 	print(n - z, end=" ")
	# if k % 2 == 0:
	# 	print((diff+n)//2)

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


import sys
n, k = map(int, input().split())
if k == 1:
    for i in range(1, n+1):
        print(i, end=' ')
    return;
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, 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)))))


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())


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