// Problem : B. Greg and Graph
// Contest : Codeforces - Codeforces Round #179 (Div. 1)
// URL : https://codeforces.com/problemset/problem/295/B
// Memory Limit : 256 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define vp vector<pair<int,int>>
#define mod 1000000007
#define M_PI 3.14159265358979323846
#define pint pair<int,int>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,b,a) for(int i=b; i>=a ;--i)
#define mms(a,n) memset(a,n,sizeof(a))
#define fill(a,value) fill(a.begin(),a.end(),value)
#define all(a) a.begin(),a.end()
#define n_ones(x) __builtin_popcountll(x)
#define pb push_back
#define fi first
#define se second
#define see(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it){}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
}
template <typename T, typename U>inline void min_self(T &x, U y){if (y < x)x = y;}
template <typename T, typename U>inline void max_self(T &x, U y){if (x < y)x = y;}
template<class T1, class T2>ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<"["<<v.first<<", "<<v.second<<"]"; return out<<")"; }
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
template <class Container>
void split(const std::string& str, Container& cont, char delim = ',')
{
    stringstream ss(str);
    string token;
    while (std::getline(ss, token, delim)) {
        cont.push_back(token);
    }
}

// cout << fixed << setprecision(10) << pi <<" "<<npi<<endl;
// INT64_MAX
// transform(all(s), s.begin(), ::tolower);

int px[4] = {-1,0,1,0};
int py[4] = {0,-1,0,1};

void solve(){
    int n, res = 0;
    cin>>n ;
    int a[n+1][n+1];
    rep(i,1,n) rep(j,1,n) cin>>a[i][j];

    vi q(n);
    cin>>q;
    reverse(all(q));
    vi ans;
    rep(k,0,n-1){
    	int sum = 0;
    	rep(i,0,n-1){
    		rep(j,0,n-1){
    			min_self(a[q[i]][q[j]], a[q[i]][q[k]]+a[q[k]][q[j]]);
    			if(i<=k && j<=k)sum += a[q[i]][q[j]];
    		}
    	}
    	ans.pb(sum);
    }

	per(i,n-1,0) cout<<ans[i]<<' ';
	cout<<'\n';

	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}


// Problem : B. Greg and Graph
// Contest : Codeforces - Codeforces Round #179 (Div. 1)
// URL : https://codeforces.com/problemset/problem/295/B
// Memory Limit : 256 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define vp vector<pair<int,int>>
#define mod 1000000007
#define M_PI 3.14159265358979323846
#define pint pair<int,int>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,b,a) for(int i=b; i>=a ;--i)
#define mms(a,n) memset(a,n,sizeof(a))
#define fill(a,value) fill(a.begin(),a.end(),value)
#define all(a) a.begin(),a.end()
#define n_ones(x) __builtin_popcountll(x)
#define pb push_back
#define fi first
#define se second
#define see(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it){}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
}
template <typename T, typename U>inline void min_self(T &x, U y){if (y < x)x = y;}
template <typename T, typename U>inline void max_self(T &x, U y){if (x < y)x = y;}
template<class T1, class T2>ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<"["<<v.first<<", "<<v.second<<"]"; return out<<")"; }
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
template <class Container>
void split(const std::string& str, Container& cont, char delim = ',')
{
    stringstream ss(str);
    string token;
    while (std::getline(ss, token, delim)) {
        cont.push_back(token);
    }
}

// cout << fixed << setprecision(10) << pi <<" "<<npi<<endl;
// INT64_MAX
// transform(all(s), s.begin(), ::tolower);

int px[4] = {-1,0,1,0};
int py[4] = {0,-1,0,1};

void solve(){
    int n, res = 0;
    cin>>n ;
    int a[n+1][n+1];
    rep(i,1,n) rep(j,1,n) cin>>a[i][j];

    int q[n+1];
	rep(i,1,n) cin>>q[i];
    reverse(q+1,q+n+1);
	stack<int> st;
    rep(k,1,n){
    	int sum = 0;
    	rep(i,1,n){
    		rep(j,1,n){
    			min_self(a[q[i]][q[j]], a[q[i]][q[k]]+a[q[k]][q[j]]);
    			if(i<=k && j<=k)sum += a[q[i]][q[j]];
    		}
    	}
    	st.push(sum);
    }

	while(!st.empty()) cout<<st.top()<<' ',st.pop();
	cout<<'\n';

	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}


#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>

using namespace std;
typedef  long long li;
const li MAX = (li)5e2 + 2;
li inf = (li)2e9;
li mod = (li)1e9 + 7;
li rev[MAX], revrev[MAX];
li dist[MAX][MAX];
li dp[MAX][MAX];
vector<li> out;
int main() {
	ios::sync_with_stdio(0);
	li n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			li a;
			cin >> a;
			dp[i][j] = a;
		}
	}
	for (int i = 1; i <= n; i++) {
		li a;
		cin >> a;
		rev[a] = n - i + 1;
		revrev[n - i + 1] = a;
	}
	for (int cur = 1; cur <= n; cur++) {
		li cursum = 0;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (i == j) continue;
				else {
					dp[i][j] = min(dp[i][j], dp[i][revrev[cur]] + dp[revrev[cur]][j]);
					if (rev[i] <= cur && rev[j] <= cur) cursum += dp[i][j];
					// if (cur == 1 && i == 2 && j == 3) cout << dp[2][3] << "\n";
				}
			}
		}
		out.push_back(cursum);
	}
	cout << dp[1][2] << " ";
	reverse(out.begin(), out.end());
	for (int i = 0; i < n; i++) cout << out[i] << " ";
	return 0;
}


#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>

using namespace std;
typedef  long long li;
const li MAX = (li)5e2+ 2;
li inf = (li)2e9;
li mod = (li)1e9 + 7;
li rev[MAX], revrev[MAX];
li dist[MAX][MAX];
li dp[MAX][MAX];
vector<li> out;
int main() {
	ios::sync_with_stdio(0);
	li n;
	cin >> n;
	for (int i = 1; i <= n; i++){
	    for (int j = 1; j <= n; j++){
	        li a;
	        cin >> a;
	        dist[i][j] = a;
	    }
	}
	for (int i = 1; i <= n; i++){
	    li a;
	    cin >> a;
	    rev[a] = n - i + 1;
	    revrev[n - i + 1] = a;
 	}
 	for (int cur = 1; cur <= n; cur++){
 	    li cursum = 0;
 	    for (int i = 1; i <= n; i++){
 	        for (int j = 1; j <= n; j++){
 	            if (i == j) continue;
 	            else{
                     if (!dp[i][j])
                     dp[i][j] = dist[i][j];
                     dp[i][j] = min(dp[i][j], dp[i][revrev[cur]] + dp[revrev[cur]][j]);
                     if (rev[i] <= cur && rev[j] <= cur) cursum += dp[i][j];
                    // if (cur == 1 && i == 2 && j == 3) cout << dp[2][3] << "\n";
 	            }
 	        }
 	    }
 	    out.push_back(cursum);
 	}
 	reverse(out.begin(), out.end());
 	for (int i = 0; i < n; i++) cout << out[i] << " ";
	return 0;
}


#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>

using namespace std;
typedef  int li;
const li MAX = (li)5e2+ 2;
li inf = (li)2e9;
li mod = (li)1e9 + 7;
li rev[MAX];
li dist[MAX][MAX];
li dp[MAX][MAX];
vector<li> out;
int main() {
	ios::sync_with_stdio(0);
	li n;
	cin >> n;
	for (int i = 1; i <= n; i++){
	    for (int j = 1; j <= n; j++){
	        li a;
	        cin >> a;
	        dist[i][j] = a;
	    }
	}
	for (int i = 1; i <= n; i++){
	    li a;
	    cin >> a;
	    rev[a] = n - i + 1;
 	}
 	for (int cur = 1; cur <= n; cur++){
 	    li cursum = 0;
 	    for (int i = 1; i <= n; i++){
 	        for (int j = 1; j <= n; j++){
 	            if (i == j) continue;
 	            else{
                     if (!dp[i][j])
                     dp[i][j] = dist[i][j];
                     dp[i][j] = min(dp[i][j], dp[i][rev[cur]] + dp[rev[cur]][j]);
                     if (rev[i] <= cur && rev[j] <= cur) cursum += dp[i][j];
                    // if (cur == 1 && i == 2 && j == 3) cout << dp[2][3] << "\n";
 	            }
 	        }
 	    }
 	    out.push_back(cursum);
 	}
 	reverse(out.begin(), out.end());
 	for (int i = 0; i < n; i++) cout << out[i] << " ";
	return 0;
}


#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>

using namespace std;
typedef  long long li;
const li MAX = (li)5e2+ 2;
li inf = (li)2e9;
li mod = (li)1e9 + 7;
li rev[MAX];
li dist[MAX][MAX];
li dp[MAX][MAX];
vector<li> out;
int main() {
	ios::sync_with_stdio(0);
	li n;
	cin >> n;
	for (int i = 1; i <= n; i++){
	    for (int j = 1; j <= n; j++){
	        li a;
	        cin >> a;
	        dist[i][j] = a;
	    }
	}
	for (int i = 1; i <= n; i++){
	    li a;
	    cin >> a;
	    rev[a] = n - i + 1;
 	}
 	for (int cur = 1; cur <= n; cur++){
 	    li cursum = 0;
 	    for (int i = 1; i <= n; i++){
 	        for (int j = 1; j <= n; j++){
 	            if (i == j) continue;
 	            else{
                     if (!dp[i][j])
                     dp[i][j] = dist[i][j];
                     dp[i][j] = min(dp[i][j], dp[i][rev[cur]] + dp[rev[cur]][j]);
                     if (rev[i] <= cur && rev[j] <= cur) cursum += dp[i][j];
                    // if (cur == 1 && i == 2 && j == 3) cout << dp[2][3] << "\n";
 	            }
 	        }
 	    }
 	    out.push_back(cursum);
 	}
 	reverse(out.begin(), out.end());
 	for (int i = 0; i < n; i++) cout << out[i] << " ";
	return 0;
}


#include <iostream>
using namespace std;

int main() {

    int n, k; cin >> n >> k;

    int s = 1, f = n;
    bool first = true;
    for(int i=0; i < k - 1; i++){
        if(first) first = false;
        else cout << " ";

        if(i % 2 == 0){
            cout << s;
            s++;
        }else{
            cout << f;
            f--;
        }
    }

    for(int q=( (k-1) % 2 != 0) ? f : s, i = 0; i < n - k + 1; q += ( (k-1) % 2 != 0) ? -1 : 1, i++){
        if(first) first = false;
        else cout << " ";
        cout << q;
    }
    return 0;
}


#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
int main() {
    int n, k;

    cin >> n >> k;

    ll currentNum = 0;
    int i;
    for(i=1; i <= k; i++){
currentNum += i;
cout << currentNum << " ";
        //if(i != k) cout << " ";
    }

    int remaning = n - k;
    for(int j=remaning; j <= n; j++){
    currentNum += i;
    cout << currentNum;
    if(j != n) cout << " ";
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int i=1,j=k+1;
    while(j!=i)
    {
        printf("%d %d ",j,i);
        j-=1;
        i+=1;
    }
    printf("%d ",j);
    for(int z=k+2;z<=n;z++)
    {
        printf("%d ",z);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int i=1,j=k+1;
    while(j!=i)
    {
        cout<<j<<" "<<i<<" ";
        j-=1;
        i+=1;
    }
    cout<<j<<" ";
    for(int z=k+2;z<=n;z++)
    {
        cout<<z<<" ";
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define INF 1000000009;
using namespace std;
int arr[10000];
int main()
{
	int a,b;
	cin>>a>>b;
	cout<<1<<" "<<1+b<<" ";
	for(int i=1;i<a;i++)
	if(i+1!=b+1)
	cout<<i+1<<" ";
	cout<<endl;
return 0;
}


//Cok tavsanin pesinde kosan hicbrini yakalmaz!
#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"Continue Debugging!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int arr[MAXN],vis[MAXN];
int main(){
	int a,k;
	cin>>a>>k;
	arr[1]=1;
	vis[1]=1;
	int c=2;
	for(int i=k;i>=1;i--){
		if(arr[c-1]-i>=1 and !vis[arr[c-1]-i])
			arr[c]=arr[c-1]-i;
		else
			arr[c]=arr[c-1]+i;
		vis[arr[c]]=1;
		c++;
	}
	for(int i=1;i<=a;i++){
		if(!vis[i])
			arr[c++]=i;
	}
	for(int i=1;i<=a;i++)
		cout<<arr[i]<<" ";
	cout<<endl;
	return 0;
}


//Cok tavsanin pesinde kosan hicbrini yakalmaz!
#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"Continue Debugging!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int arr[MAXN],vis[MAXN];
int main(){
	int a,k;
	cin>>a>>k;
	arr[1]=1;
	vis[1]=1;
	int c=2;
	for(int i=k;i>=1;i--){
		if(arr[c-1]-i>=1)
			arr[c]=arr[c-1]-i;
		else
			arr[c]=arr[c-1]+i;
		vis[arr[c]]=1;
		c++;
	}
	for(int i=1;i<=a;i++){
		if(!vis[i])
			arr[c++]=i;
	}
	for(int i=1;i<=a;i++)
		cout<<arr[i]<<" ";
	cout<<endl;
	return 0;
}


//Cok tavsanin pesinde kosan hicbrini yakalmaz!
#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"Continue Debugging!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int arr[MAXN],vis[MAXN];
int main(){
	int a,k;
	cin>>a>>k;
	arr[1]=1;
	vis[1]=1;
	int c=2;
	for(int i=k;i>=1;i--){
		if(arr[c-1]+i<=a)
			arr[c]=arr[c-1]+i;
		else
			arr[c]=arr[c-1]-i;
		vis[arr[c]]=1;
		c++;
	}
	for(int i=1;i<=a;i++){
		if(!vis[i])
			arr[c++]=i;
	}
	for(int i=1;i<=a;i++)
		cout<<arr[i]<<" ";
	cout<<endl;
	return 0;
}


/* @author KARTIK KESHRI */
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<math.h>
#include<string.h>
#include<limits.h>
#include<assert.h>
using namespace std;
#define get getchar//_unlocked
#define mod 1000000007
#define s(n) scanf("%d",&n)
#define p(n) printf("%d\n",n)
#define ss(n) scanf("%lld",&n)
#define pp printf("%lld\n",n)
#define sss(n) scanf("%llu",&n)
#define ppp(n) printf("%llu\n",n)
#define st(s) scanf("%s",s)
#define pst(s) printf("%s\n",s)
#define bitcnt(x) __builtin_popcountll(x)
#define fo(i,x,n) for(int i=x;i<=int(n);i++)
#define fob(i,x,n) for(int i=int(n);i>=x;i--)
#define set(a,x) memset(a,x,sizeof(a)) //0 or -1
#define fill(a,x,b,n) for(int i=b;i<n+1;i++) a[i]=x;
#define all(v) (v).begin(),(v).end()
#define tr(v,it) for(typeof(v) it=v.begin();it!=v.end();it++)
#define maxi(a,x,n) *max_element(a+x,a+n)
#define mini(a,x,n) *min_element(a+x,a+n)
#define mp(x,y) make_pair(x,y)
#define present(v,x) find(all(v),x)//-v.begin() give index
#define pb push_back
#define add(v) evaculate(all(v),(long long)0)
#define multiply(v) accumulate(all(v), long long(1), multiplies<long long>());
#define sqr(x) x*x
#define wh() int t; for(int i=0;i<t;i++)
#define MAX INT_MAX
typedef unsigned long long int llu;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
//const long double pi=3.1415926535897932384626433832795;

ll inp()
{
    ll n=0,s=1;
    char c;
    for(c=get();c<48||c>58;c=get())
    if(c=='-')s=-1;
    for(;c>47&&c<59;c=get())
    n=n*10+c-48;
    return n*s;
}
ll gcd(ll a,ll b)
{
     if(b==0)
     return a;
     else gcd(b,a%b);
}

ll square(ll n) { return n*n; }

ll bigmod(ll b,ll p,ll m) {
if (p == 0)
return 1;
else if (p%2 == 0)
return square(bigmod(b,p/2,m)) % m; // square(x) = x * x
else
return ((b % m) * bigmod(b,p-1,m)) % m;
}

long long mulmod(long long a,long long b,long long c){
    long long x = 0,y=a%c;
    while(b > 0){
        if(b%2 == 1){
            x = (x+y)%c;
        }
        y = (y*2)%c;
        b /= 2;
    }
    return x%c;
}
ll a[100005];
ll b[100005];
int main()
{
 ll t,i,j,k,n,m,s=0;
 ss(n);
 ss(k);
 for(i=1;i<=n;i++) a[i]=i;
 a[1]=1;
 b[1]=1;

 ll c=k+1;
 ll l=1;

 for(i=1;i<=k+1;i++)
 {
    if(i%2==1)
    cout<<l++ <<" ";
    else
    cout<<c--<<" ";
 }
 for(;i<=n;i++)
 {
    cout<<i<<" ";
 }
 return 0;
}


/* @author KARTIK KESHRI */
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<math.h>
#include<string.h>
#include<limits.h>
#include<assert.h>
using namespace std;
#define get getchar//_unlocked
#define mod 1000000007
#define s(n) scanf("%d",&n)
#define p(n) printf("%d\n",n)
#define ss(n) scanf("%lld",&n)
#define pp printf("%lld\n",n)
#define sss(n) scanf("%llu",&n)
#define ppp(n) printf("%llu\n",n)
#define st(s) scanf("%s",s)
#define pst(s) printf("%s\n",s)
#define bitcnt(x) __builtin_popcountll(x)
#define fo(i,x,n) for(int i=x;i<=int(n);i++)
#define fob(i,x,n) for(int i=int(n);i>=x;i--)
#define set(a,x) memset(a,x,sizeof(a)) //0 or -1
#define fill(a,x,b,n) for(int i=b;i<n+1;i++) a[i]=x;
#define all(v) (v).begin(),(v).end()
#define tr(v,it) for(typeof(v) it=v.begin();it!=v.end();it++)
#define maxi(a,x,n) *max_element(a+x,a+n)
#define mini(a,x,n) *min_element(a+x,a+n)
#define mp(x,y) make_pair(x,y)
#define present(v,x) find(all(v),x)//-v.begin() give index
#define pb push_back
#define add(v) evaculate(all(v),(long long)0)
#define multiply(v) accumulate(all(v), long long(1), multiplies<long long>());
#define sqr(x) x*x
#define wh() int t; for(int i=0;i<t;i++)
#define MAX INT_MAX
typedef unsigned long long int llu;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
//const long double pi=3.1415926535897932384626433832795;

ll inp()
{
    ll n=0,s=1;
    char c;
    for(c=get();c<48||c>58;c=get())
    if(c=='-')s=-1;
    for(;c>47&&c<59;c=get())
    n=n*10+c-48;
    return n*s;
}
ll gcd(ll a,ll b)
{
     if(b==0)
     return a;
     else gcd(b,a%b);
}

ll square(ll n) { return n*n; }

ll bigmod(ll b,ll p,ll m) {
if (p == 0)
return 1;
else if (p%2 == 0)
return square(bigmod(b,p/2,m)) % m; // square(x) = x * x
else
return ((b % m) * bigmod(b,p-1,m)) % m;
}

long long mulmod(long long a,long long b,long long c){
    long long x = 0,y=a%c;
    while(b > 0){
        if(b%2 == 1){
            x = (x+y)%c;
        }
        y = (y*2)%c;
        b /= 2;
    }
    return x%c;
}
ll a[100005];
ll b[100005];
int main()
{
 ll t,i,j,k,n,m,s=0;
 ss(n);
 ss(k);
 for(i=1;i<=n;i++) a[i]=i;
 a[1]=1;
 b[1]=1;

 ll c=k+1;
 ll l=1;
 cout<<"1 ";
 for(i=1;i<=k+1;i++)
 {
    if(i%2==1)
    cout<<l++ <<" ";
    else
    cout<<c--<<" ";
 }
 for(;i<=n;i++)
 {
    cout<<i<<" ";
 }
 return 0;
}


/* @author KARTIK KESHRI */
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<math.h>
#include<string.h>
#include<limits.h>
#include<assert.h>
using namespace std;
#define get getchar//_unlocked
#define mod 1000000007
#define s(n) scanf("%d",&n)
#define p(n) printf("%d\n",n)
#define ss(n) scanf("%lld",&n)
#define pp printf("%lld\n",n)
#define sss(n) scanf("%llu",&n)
#define ppp(n) printf("%llu\n",n)
#define st(s) scanf("%s",s)
#define pst(s) printf("%s\n",s)
#define bitcnt(x) __builtin_popcountll(x)
#define fo(i,x,n) for(int i=x;i<=int(n);i++)
#define fob(i,x,n) for(int i=int(n);i>=x;i--)
#define set(a,x) memset(a,x,sizeof(a)) //0 or -1
#define fill(a,x,b,n) for(int i=b;i<n+1;i++) a[i]=x;
#define all(v) (v).begin(),(v).end()
#define tr(v,it) for(typeof(v) it=v.begin();it!=v.end();it++)
#define maxi(a,x,n) *max_element(a+x,a+n)
#define mini(a,x,n) *min_element(a+x,a+n)
#define mp(x,y) make_pair(x,y)
#define present(v,x) find(all(v),x)//-v.begin() give index
#define pb push_back
#define add(v) evaculate(all(v),(long long)0)
#define multiply(v) accumulate(all(v), long long(1), multiplies<long long>());
#define sqr(x) x*x
#define wh() int t; for(int i=0;i<t;i++)
#define MAX INT_MAX
typedef unsigned long long int llu;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
//const long double pi=3.1415926535897932384626433832795;

ll inp()
{
    ll n=0,s=1;
    char c;
    for(c=get();c<48||c>58;c=get())
    if(c=='-')s=-1;
    for(;c>47&&c<59;c=get())
    n=n*10+c-48;
    return n*s;
}
ll gcd(ll a,ll b)
{
     if(b==0)
     return a;
     else gcd(b,a%b);
}

ll square(ll n) { return n*n; }

ll bigmod(ll b,ll p,ll m) {
if (p == 0)
return 1;
else if (p%2 == 0)
return square(bigmod(b,p/2,m)) % m; // square(x) = x * x
else
return ((b % m) * bigmod(b,p-1,m)) % m;
}

long long mulmod(long long a,long long b,long long c){
    long long x = 0,y=a%c;
    while(b > 0){
        if(b%2 == 1){
            x = (x+y)%c;
        }
        y = (y*2)%c;
        b /= 2;
    }
    return x%c;
}
ll a[100005];
ll b[100005];
int main()
{
 ll t,i,j,k,n,m,s=0;
 ss(n);
 ss(k);
 for(i=1;i<=n;i++) a[i]=i;
 a[1]=1;
 b[1]=1;

 ll c=0;
 for(i=2;(i+1)<=n;i+=2)
 {
    c++;
    if(c>k/2)
    break;
    swap(a[i],a[i+1]);
    i++;

 }
 k=1;
 for(i=1;i<=n;i++)
 {
    cout<<a[i]<<" ";

 }
 return 0;
}


/* @author KARTIK KESHRI */
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<math.h>
#include<string.h>
#include<limits.h>
#include<assert.h>
using namespace std;
#define get getchar//_unlocked
#define mod 1000000007
#define s(n) scanf("%d",&n)
#define p(n) printf("%d\n",n)
#define ss(n) scanf("%lld",&n)
#define pp printf("%lld\n",n)
#define sss(n) scanf("%llu",&n)
#define ppp(n) printf("%llu\n",n)
#define st(s) scanf("%s",s)
#define pst(s) printf("%s\n",s)
#define bitcnt(x) __builtin_popcountll(x)
#define fo(i,x,n) for(int i=x;i<=int(n);i++)
#define fob(i,x,n) for(int i=int(n);i>=x;i--)
#define set(a,x) memset(a,x,sizeof(a)) //0 or -1
#define fill(a,x,b,n) for(int i=b;i<n+1;i++) a[i]=x;
#define all(v) (v).begin(),(v).end()
#define tr(v,it) for(typeof(v) it=v.begin();it!=v.end();it++)
#define maxi(a,x,n) *max_element(a+x,a+n)
#define mini(a,x,n) *min_element(a+x,a+n)
#define mp(x,y) make_pair(x,y)
#define present(v,x) find(all(v),x)//-v.begin() give index
#define pb push_back
#define add(v) evaculate(all(v),(long long)0)
#define multiply(v) accumulate(all(v), long long(1), multiplies<long long>());
#define sqr(x) x*x
#define wh() int t; for(int i=0;i<t;i++)
#define MAX INT_MAX
typedef unsigned long long int llu;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
//const long double pi=3.1415926535897932384626433832795;

ll inp()
{
    ll n=0,s=1;
    char c;
    for(c=get();c<48||c>58;c=get())
    if(c=='-')s=-1;
    for(;c>47&&c<59;c=get())
    n=n*10+c-48;
    return n*s;
}
ll gcd(ll a,ll b)
{
     if(b==0)
     return a;
     else gcd(b,a%b);
}

ll square(ll n) { return n*n; }

ll bigmod(ll b,ll p,ll m) {
if (p == 0)
return 1;
else if (p%2 == 0)
return square(bigmod(b,p/2,m)) % m; // square(x) = x * x
else
return ((b % m) * bigmod(b,p-1,m)) % m;
}

long long mulmod(long long a,long long b,long long c){
    long long x = 0,y=a%c;
    while(b > 0){
        if(b%2 == 1){
            x = (x+y)%c;
        }
        y = (y*2)%c;
        b /= 2;
    }
    return x%c;
}
ll a[100005];
ll b[100005];
int main()
{
 ll t,i,j,k,n,m,s=0;
 ss(n);
 ss(k);
 for(i=1;i<=n;i++) a[i]=i;
 a[1]=1;
 b[1]=1;

 ll c=0;
 for(i=2;(i+1)<=n;i+=2)
 {
    c++;
    if(c>k/2)
    break;
    swap(a[i],a[i+1]);

 }
 k=1;
 for(i=1;i<=n;i++)
 {
    cout<<a[i]<<" ";

 }
 return 0;
}


#include <iostream>
using namespace std;
bool vis[100000];
int main() {
	int a , b  , k=1;
	cin>>a>>b;
	cout<<1<<" " ;
	int c = b;
	for(int j=0 ; j<c-1 ; j++){
		if(k-b>=1){
			vis[k-b]=true;
			cout<<k-a<<" ";
			--b;
		}
		else
		if(k+b <=a){
			vis[k+b]=true;
			cout<<k+b<<" ";
			--b;

		}
	}
	for(int j = 2 ; j<=a ; j++)
	if(!vis[j])cout<<j<<" ";
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;
bool vis[100000];
int main() {
	int a , b  , k=1;
	cin>>a>>b;
	cout<<1<<" " ;
	int c = b;
	for(int j=0 ; j<c-1 ; j++){
		if(k-b>=2){
			vis[k-b]=true;
			cout<<k-a<<" ";
			--b;
			k=k-b;
		}
		else
		if(k+b <=a){
			vis[k+b]=true;
			cout<<k+b<<" ";
			--b;
			k=k+b;

		}
	}
	for(int j = 2 ; j<=a ; j++)
	if(!vis[j])cout<<j<<" ";
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;
bool vis[100000];
int main() {
	int a , b  , k=1;
	cin>>a>>b;
	cout<<1<<" " ;
	int c = b;
	for(int j=0 ; j<c-1 ; j++){
	//	cout<<"*"<<k<<b<<"*";
		if(k-b>=2 && !vis[k-b]){
			vis[k-b]=true;
			cout<<k-b<<" ";
			k=k-b;
			--b;
		}
		else
		if(k+b <=a){
			vis[k+b]=true;
			cout<<k+b<<" ";
			k=k+b;
			--b;

		}
	}
	for(int j = 2 ; j<=a ; j++)
	if(!vis[j])cout<<j<<" ";
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;
bool vis[100000];
int main() {
	int a , b  , k=1;
	cin>>a>>b;
	cout<<1<<" " ;
	int c = b;
	for(int j=0 ; j<c-1 ; j++){
	//	cout<<"*"<<k<<b<<"*";
		if(k-b>=2){
			vis[k-b]=true;
			cout<<k-b<<" ";
			k=k-b;
			--b;
		}
		else
		if(k+b <=a){
			vis[k+b]=true;
			cout<<k+b<<" ";
			k=k+b;
			--b;

		}
	}
	for(int j = 2 ; j<=a ; j++)
	if(!vis[j])cout<<j<<" ";
	// your code goes here
	return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>

typedef long long int uli;
const int mx=1e5+10;

using namespace std;
int n,k,v[mx];
int main(){
    //    freopen("data.in","r",stdin);
    scanf("%d%d",&n,&k);
    int j=1,t;
    for(int i=0+(n%2==0);i<=n;i+=2){
        v[i]=j;
        j++;
        t=i-1;
    }

    for(int i=t;i>=0;i-=2){
        v[i]=j;
        j++;
    }
    if(k==n-1){
        for(int i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        return 0;
    }
    if(n%2!=0){
        if(k%2==0)sort(v,v+n-k);
        else sort(v+k,v+n);
    }
    else{
        if(k%2==0)sort(v+k,v+n);
        else sort(v,v+n-k+(1));
    }
    /*
    set <int> a;
    for(int i=0;i<n-1;i++){
//        cout<<abs(v[i+1]-v[i])<<endl;
        a.insert(abs(v[i+1]-v[i]));
    }
    cout<<endl;
    if(k==(int)a.size())cout<<"YEAH!"<<endl;
    else cout<<":(";
    */

    for(int i=0;i<n;i++){
        printf("%d ",v[i]);
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>

typedef long long int uli;
const int mx=1e5+10;

using namespace std;
int n,k,v[mx];
int main(){
    //    freopen("data.in","r",stdin);
    scanf("%d%d",&n,&k);
    int j=1,t;
    for(int i=1+(n%2==0);i<=n;i+=2){
        v[i]=j;
        j++;
        t=i-1;
    }
    for(int i=t;i>0;i-=2){
        v[i]=j;
        j++;
    }
    if(n%2!=0){
        if(k%2==0)sort(v+1,v+1+n-k);
        else sort(v+1+k,v+1+n);
    }
    else{
        if(k%2==0)sort(v+1+k,v+1+n);
        else sort(v+1,v+1+n-k+(1==k));
    }

    for(int i=1;i<=n;i++){
        printf("%d ",v[i]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <bitset>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <iomanip>
typedef long long int ll;

using namespace std;
int n,k,v[mx];
int main(){
    //    freopen("data.in","r",stdin);
    //scanf("%d%d",&n,&k);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>k;
    int ni=1,nj=n;
    for(int i=0;i<n;i++){
        if(i%2==0){
            v[i]=ni;
            ni++;
        }
        else{
            v[i]=nj;
            nj--;
        }
    }
    if(k%2==0)sort(v+k,v+n,greater <int>() );
    else sort(v+k,v+n );
    for(int i=0;i<n;i++){
        cout<<v[i]<<" ";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <bitset>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <iomanip>
typedef long long int ll;
const int mx=1e5+10;
using namespace std;
int n,k,v[mx];
int main(){
    //    freopen("data.in","r",stdin);
    //scanf("%d%d",&n,&k);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>k;
    int ni=1,nj=n;
    for(int i=0;i<n;i++){
        if(i%2==0){
            v[i]=ni;
            ni++;
        }
        else{
            v[i]=nj;
            nj--;
        }
    }
    if(k%2==0)sort(v+k,v+n,greater <int>() );
    else sort(v+k,v+n );
    for(int i=0;i<n;i++){
        cout<<v[i]<<" ";
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>

typedef long long int uli;
const int mx=1e5+10;

using namespace std;
int n,k,v[mx];
int main(){
    //    freopen("data.in","r",stdin);
    scanf("%d%d",&n,&k);
    int j=1,t;
    for(int i=0+(n%2==0);i<=n;i+=2){
        v[i]=j;
        j++;
        t=i-1;
    }

    for(int i=t;i>=0;i-=2){
        v[i]=j;
        j++;
    }
    if(k==n-1){
        for(int i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        return 0;
    }
    if(n%2!=0){
        if(k%2==0)sort(v,v+n-k+1);
        else sort(v+k-(k==1),v+n);
    }
    else{
        if(k%2==0)sort(v+k,v+n);
        else sort(v,v+n-k+(1));
    }
/*
    set <int> a;
    for(int i=0;i<n-1;i++){
//        cout<<abs(v[i+1]-v[i])<<endl;
        a.insert(abs(v[i+1]-v[i]));
    }
    cout<<endl;
    if(k==(int)a.size())cout<<"YEAH!"<<endl;
    else cout<<":(";
*/

    for(int i=0;i<n;i++){
        printf("%d ",v[i]);
    }

    return 0;
}


#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<set>
#include<algorithm>
#include<stdio.h>
#define F first
#define S second
#define P system("PAUSE");
using namespace std;
const long long A=1000000000LL,N=1000000;

long long h=1,a[N],i,j,n,m,k,b[N];

int main(){
    cin>>n>>k;k++;
    a[0]=1;b[1]=1;
    for(i=1;i<n;i++){
        k--;
        if(!k)break;
        h++;
        if(h%2)a[i]=a[i-1]-k;else a[i]=a[i-1]+k;
        b[a[i]]=1;
    }j=1;
    for(;i<n;i++){
        for(;j<=n;j++)if(!b[j])break;
        a[i]=j;j++;
    }
    for(i=0;i<n;i++)cout<<a[i]<<" ";
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
bool a[100005];
vector<int>ans;
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int j=1,xx=1;
    ans.pb(1);
    a[1]=1;
    for(int i=k;i>=1;i--)
    {
        if(xx){a[ans[ans.size()-1]+i]=1;ans.pb(ans[ans.size()-1]+i);xx=0;}
        else {a[ans[ans.size()-1]-i]=1;ans.pb(ans[ans.size()-1]-i);xx=1;}
    }
    for(int i=1;i<=n;i++)if(!a[i])ans.pb(i);
    for(int i=0;i<n-1;i++)printf("%d ",ans[i]);
    printf("%d\n",ans[n-1]);

}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
bool t[100005];
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    vector<int>x;
    x.pb(1);
    t[1]=1;
    int c=1;
    if(n!=1){
        int cur=1+k;
        x.pb(cur);
        c++;
        t[cur]=1;
        int i;
        for( i=k-1;i>1;i--)
        {
            if(cur-i<=0) break;

            x.pb(cur-i);
            cur=cur-i;
            t[cur]=1;

        }
        for(;i>1;i--)
        {
             if(cur+i>n) break;
            if(!t[cur+i]){
            x.pb(cur+i);
            cur=cur+i;
            t[cur]=1;
            }

        }
        for(int i=1;i<=n;i++)
        {
            if(!t[i])x.pb(i);
        }

    }
    for(int i=0;i<x.size()-1;i++)printf("%d ",x[i]);
    printf("%d\n",x[x.size()-1]);
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
bool a[100005];
vector<int>ans;
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int j=1,xx=1;
    ans.pb(1);
    a[1]=1;
    for(int i=k;i>=1;i--)
    {
        if(xx){ans.pb(ans[ans.size()-1]+i);xx=0;a[ans[ans.size()-1]+i]=1;}
        else {ans.pb(ans[ans.size()-1]-i);xx=1;a[ans[ans.size()-1]-i]=1;}
    }
    for(int i=1;i<=n;i++)if(!a[i])ans.pb(i);
    for(int i=0;i<n-1;i++)printf("%d ",ans[i]);
    printf("%d\n",ans[n-1]);

}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
bool t[100005];
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    vector<int>x;
    x.pb(1);
    t[1]=1;
    int c=1;
    if(n!=1){
        int cur=1+k;
        x.pb(cur);
        c++;
        t[cur]=1;
        int i;
        for( i=k-1;i>1;i--)
        {
            if(cur-i<=0) break;

            x.pb(cur-i);
            cur=cur-i;
            t[cur]=1;

        }
        for(;i>1;i--)
        {
            if(!t[cur+i]){
            x.pb(cur+i);
            cur=cur+i;
            t[cur]=1;
            }

        }
        for(int i=1;i<=n;i++)
        {
            if(!t[i])x.pb(i);
        }

    }
    for(int i=0;i<x.size()-1;i++)printf("%d ",x[i]);
    printf("%d\n",x[x.size()-1]);
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
bool t[100005];
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    vector<int>x;
    x.pb(1);
    t[1]=1;
    int c=1;
    if(n!=1){
        int cur=1+k;
        x.pb(cur);
        c++;
        t[cur]=1;
        int i;
        for( i=k-1;i>=1;i--)
        {
            if(cur-i<=0) break;
            if(!t[cur-i]){
            x.pb(cur-i);
            cur=cur-i;
            t[cur]=1;
            }
        }
        for(;i>=1;i--)
        {
            if(!t[cur+i]){
            x.pb(cur+i);
            cur=cur+i;
            t[cur]=1;
            }

        }
        for(int i=1;i<=n;i++)
        {
            if(!t[i])x.pb(i);
        }

    }
    for(int i=0;i<x.size()-1;i++)printf("%d ",x[i]);
    printf("%d\n",x[x.size()-1]);
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
bool t[100005];
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    vector<int>x;
    x.pb(1);
    t[1]=1;
    int cur=1;
    if(n!=1){

       for(int i=k;i>=1;i--)
       {
           if(cur+i<=n)
           {
               t[cur+i]=1;
               x.pb(cur+i);
               cur+=i;
           }
           else
           {
               t[cur-i]=1;
               x.pb(cur-i);
               cur-=i;
           }
       }
        for(int i=1;i<=n;i++)
        {
            if(!t[i])x.pb(i);
        }

    }
    for(int i=0;i<x.size()-1;i++)printf("%d ",x[i]);
    printf("%d\n",x[x.size()-1]);
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
bool t[100005];
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    vector<int>x;
    x.pb(1);
    t[1]=1;
    int c=1;
    if(n!=1){
        int cur=1+k;
        x.pb(cur);
        c++;
        t[cur]=1;
        for(int i=k-1;i>1;i--)
        {
            c++;
            x.pb(cur-i);
            cur=cur-i;
            t[cur]=1;
        }
        for(int i=1;i<=n;i++)
        {
            if(!t[i])x.pb(i);
        }

    }
    for(int i=0;i<x.size()-1;i++)printf("%d ",x[i]);
    printf("%d\n",x[x.size()-1]);
    return 0;
}


#include <bits/stdc++.h>
int n,k,a,b = 1,say;
int main()
{
    scanf("%d %d",&n,&k);a = n;
    k--;
    while(a != b && k>0)printf("%d %d ",a,b),a--,b++,k -= 2;
    while(b < a+1)printf("%d ",b),b++;
}


#include <bits/stdc++.h>
int main(int n,int k)
{
    scanf("%d %d",&n,&k);
    for (int i = 1; i < n-k; i++)printf("%d ",i);
    int a = n,b = n-k;
    while(a > b)printf("%d %d ",b,a),a--,b++;
    if(a == b)printf("%d",b);
}


#include <bits/stdc++.h>
int n,k,a,b = 1;
int main()
{
    scanf("%d %d",&n,&k);a = n;
    for (int i = 1; i < k ; i++)
        printf("%d %d ",a,b),a--,b++;
    for(int i=b ; i<=a ; i++)
        printf("%d ",i);
}


#include <bits/stdc++.h>
int n,k,a,b = 1;
int main()
{
    scanf("%d %d",&n,&k);a = n;
    while(k--)
    if(k % 2)printf("%d ",a),a--;
    else printf("%d ",b),b++;
    for(int i=b ; i<=a ; i++)printf("%d ",i);
}


#include <bits/stdc++.h>
int n,k,a,b = 1,say;
int main()
{
    scanf("%d %d",&n,&k);a = n;
    k--;
    while(a != b && k)printf("%d %d ",a,b),a--,b++,k--;
    while(b < a+1)printf("%d ",b),b++;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int r=k%2;
    if(k==1)
    {
        for(int i=1;i<=n;i++)
            cout<<i<<" ";
        return 0;
    }
    int mini,maxi;
    if(r==1)
    {
    for(int i=0;i<k/2;i++)
    {
        cout<<n-i<<" "<<i+1<<" ";
        mini=i+2;
        maxi=n-i-1;
    }
    for(int i=maxi;i>=mini;i--)
    {
        cout<<i<<" ";
    }
    return 0;
    }
     for(int i=0;i<k/2+r;i++)
    {
        cout<<n-i<<" "<<i+1<<" ";
        mini=i+2;
        maxi=n-i-1;
    }
    for(int i=mini;i<=maxi;i++)
    {
        cout<<i<<" ";
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    if(k==1)
    {
        for(int i=1;i<=n;i++)
            cout<<i<<" ";
        return 0;
    }
    if(k%2==0)
    {
        for(int i=k;i>=1;i-=2)
        {
            cout<<i<<" "<<k-i+1<<" ";
        }
        for(int i=k+1;i<=n;i++)
            cout<<i<<" ";
        return 0;
    }
    if(k==n-1)
    {
        for(int i=n;i>n/2;i--)
        {
            cout<<i<<" "<<n-i+1<<" ";
        }
        return 0;
    }
    for(int i=k;i>k/2;i--)
    {
        if(i!=k-i+1)
        {
            cout<<i<<" "<<k-i+1<<" ";
        }
        else
            cout<<i<<" ";
    }
    for(int i=n;i>k;i--)
    {
        cout<<i<<" ";
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    if(k%2==0)
    {
        for(int i=k;i>=1;i-=2)
        {
            cout<<i<<" "<<k-i+1<<" ";
        }
        for(int i=k+1;i<=n;i++)
            cout<<i<<" ";
        return 0;
    }
    if(k==n-1)
    {
        for(int i=n;i>n/2;i--)
        {
            cout<<i<<" "<<n-i+1<<" ";
        }
        return 0;
    }
    for(int i=k;i>k/2;i--)
    {
        if(i!=k-i+1)
        {
            cout<<i<<" "<<k-i+1<<" ";
        }
        else
            cout<<i<<" ";
    }
    for(int i=n;i>k;i--)
    {
        cout<<i<<" ";
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    if(k==1)
    {
        for(int i=1;i<=n;i++)
            cout<<i;
        return 0;
    }
    if(k%2==0)
    {
        for(int i=k;i>=1;i-=2)
        {
            cout<<i<<" "<<k-i+1<<" ";
        }
        for(int i=k+1;i<=n;i++)
            cout<<i<<" ";
        return 0;
    }
    if(k==n-1)
    {
        for(int i=n;i>n/2;i--)
        {
            cout<<i<<" "<<n-i+1<<" ";
        }
        return 0;
    }
    for(int i=k;i>k/2;i--)
    {
        if(i!=k-i+1)
        {
            cout<<i<<" "<<k-i+1<<" ";
        }
        else
            cout<<i<<" ";
    }
    for(int i=n;i>k;i--)
    {
        cout<<i<<" ";
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int r=k%2;
    if(k==1)
    {
        for(int i=1;i<=n;i++)
            cout<<i;
        return 0;
    }
    int mini,maxi;
    if(r==1)
    {
    for(int i=0;i<k/2;i++)
    {
        cout<<n-i<<" "<<i+1<<" ";
        mini=i+2;
        maxi=n-i-1;
    }
    for(int i=maxi;i>=mini;i--)
    {
        cout<<i<<" ";
    }
    return 0;
    }
     for(int i=0;i<k/2+r;i++)
    {
        cout<<n-i<<" "<<i+1<<" ";
        mini=i+2;
        maxi=n-i-1;
    }
    for(int i=mini;i<=maxi;i++)
    {
        cout<<i<<" ";
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    if(k==1)
    {
        for(int i=1;i<=n;i++)
            cout<<i<<" ";
        return 0;
    }
    if(k%2==0)
    {
        for(int i=k;i>=1;i-=2)
        {
            cout<<i<<" "<<k-i+1<<" ";
        }
        for(int i=k+1;i<=n;i++)
            cout<<i<<" ";
        return 0;
    }
    if(k==n-1)
    {
        for(int i=n;i>n/2;i--)
        {
            cout<<i<<" "<<n-i+1<<" ";
        }
        return 0;
    }
    int mini,maxi;
    for(int i=0;i<k/2+1;i++)
    {
        cout<<n-i<<" "<<i+1<<" ";
        mini=i+2;
        maxi=n-i-1;
    }
    for(int i=mini;i<=maxi;i++)
    {
        cout<<i<<" ";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
int n,k,pd[100005],pd1,i;
int main()
{
    while (~scanf(" %d %d",&n,&k))
    {
        printf("1");
        if (k==1)
        {
            for (i=2;i<=n;i++) printf(" %d",i);
            printf("\n");
            continue;
        }
        memset(pd,0,sizeof(pd));
        pd1=0;
        pd[1]=1;
        for (i=0;i<k-1;)
        {
            if (i<k-1) {printf(" %d",n-i); pd[n-i]=1; i++;}
            if (i<k-1||i==n-2) {printf(" %d",i+1); pd[i+1]=1; i++;}
            else pd1=1;
        }
        if (pd1)
        {
            while (!pd[n-i]) {printf(" %d",n-i); i++;}
        }
        else
        {
            while (!pd[i+1]) {printf(" %d",i+1); i++;}
        }
        printf("\n");
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
int n,k,pd[100005],pd1,i,tem0,tem1;
int main()
{
    while (~scanf(" %d %d",&n,&k))
    {
        printf("1");
        if (k==1)
        {
            for (i=2;i<=n;i++) printf(" %d",i);
            printf("\n");
            continue;
        }
        memset(pd,0,sizeof(pd));
        pd1=0; tem0=0; tem1=1;
        pd[1]=1;
        for (i=0;i<k-1;)
        {
            if (i<k-1) {printf(" %d",n-tem0); pd[n-tem0]=1; i++; tem0++;}
            if (i<k-1||i==n-2) {printf(" %d",tem1+1); pd[tem1+1]=1; i++; tem1++;}
            else pd1=1;
        }
        if (pd1)
        {
            while (!pd[n-tem0]) {printf(" %d",n-tem0); tem0++;}
        }
        else
        {
            while (!pd[tem1+1]) {printf(" %d",tem1+1); tem1++;}
        }
        printf("\n");
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
int n,k,pd[100005],pd1,i;
int main()
{
    while (~scanf(" %d %d",&n,&k))
    {
        printf("1");
        if (k==1)
        {
            for (i=2;i<=n;i++) printf(" %d",i);
            printf("\n");
            continue;
        }
        memset(pd,0,sizeof(pd));
        pd1=0;
        pd[1]=1;
        for (i=0;i<k-1;)
        {
            if (i<k-1) {printf(" %d",n-i); pd[n-i]=1; i++;}
            if (i<k-1) {printf(" %d",i+1); pd[i+1]=1; i++;}
            else pd1=1;
        }
        if (pd1)
        {
            while (!pd[n-i]) {printf(" %d",n-i); i++;}
        }
        else
        {
            while (!pd[i+1]) {printf(" %d",i+1); i++;}
        }
        printf("\n");
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
int n,k,pd[100005],pd1,i,tem0,tem1;
int main()
{
    while (~scanf(" %d %d",&n,&k))
    {
        printf("1");
        if (k==1)
        {
            for (i=2;i<=n;i++) printf(" %d",i);
            printf("\n");
            continue;
        }
        memset(pd,0,sizeof(pd));
        pd1=0; tem0=0; tem1=1;
        pd[1]=1;
        for (i=0;i<k-1;)
        {
            if (i<k-1) {printf(" %d",n-tem0); pd[n-tem0]=1; i++; tem0++;}
            if (i<k-1||i==n-2) {printf(" %d",tem1+1); pd[tem1+1]=1; i++; tem1++;}
            else pd1=1;
        }
        if (pd1)
        {
            while (!pd[n-i]) {printf(" %d",n-i); i++;}
        }
        else
        {
            while (!pd[i+1]) {printf(" %d",i+1); i++;}
        }
        printf("\n");
    }
    return 0;
}


#include<bits/stdc++.h>

typedef long long int ll;
typedef unsigned long long int ull;

#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}

ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}

ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ll a,b,c,res=0,sum=0,f=0,ff=0,cnt=0;
ll ar[100100];
ll ar1[100100];
string s,ss;
int main()
{
    ios_base::sync_with_stdio(false);
    cin>>a>>b;
    int cnt=1;
    for(int i=1;i<=a;i++)
    {
        ar1[i]=i;
        ar[i]=i;
        if(i>2 and cnt<b)
        {
            swap(ar[i],ar[i-1]);
            cnt++;
        }
    }
    int i=0;
    c=0;
    if(b==a-1)
    {
        int i=1;
        int iii=0;
        int ii=1;
       while(i<=a)
       {
           if(i%2==0)
           {
               cout<<ar1[ii++]<<" ";
           }
           else
           {
               cout<<ar1[a-iii]<<" ";
               iii++;
           }
           i++;
       }
    }
    else
    rep(i,a)cout<<ar[i+1]<<" ";

    return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define fi first
#define se second
#define all(x) x.begin(),x.end()

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}
ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ull a,b,c=0,res=0,sum=0,f=0,ff=0,cnt=0;
string s,ss;
ll ar[100100];
ll mx=0,mn=1<<29;

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    long long asfjasf;
    cin>>n>>m;
    rep(i,n)
    {
        ar[i+1]=i+1;
    }
    int i=1;
    int ii=0;
    map<int,int>mpp;
    mpp.clear();
    while(i<=(m/2) and i<=n)
    {
        if(mpp[ar[n-ii]]==0)
        {
        cout<<ar[n-ii]<<" ";
         mpp[ar[n-ii]]=1;
        }
          if(mpp[ar[i]]==0)
          {
        cout<<ar[i]<<" ";
        mpp[ar[i]]=1;
          }
        ii++;
        i++;
    }
    if(m%2==0)
    for(int i=1;i<=n;i++)
    {
        if(mpp[i]==0)
            cout<<i<<" ";
    }
    else
    {
        for(int i=n;i>=1;i--)
    {
        if(mpp[i]==0)
            cout<<i<<" ";
    }
    }
    return 0;
}


#include<bits/stdc++.h>

typedef long long int ll;
typedef unsigned long long int ull;

#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}

ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}

ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ll a,b,c,res=0,sum=0,f=0,ff=0,cnt=0;
ll ar[100100];
ll ar1[100100];
string s,ss;
int main()
{
    ios_base::sync_with_stdio(false);
    cin>>a>>b;
    int cnt=1;
    for(int i=1;i<=a;i++)
    {
        ar1[i]=i;
        ar[i]=i;
        if(i>2 and cnt<b)
        {
            swap(ar[i],ar[i-1]);
            cnt++;
        }
    }
    int i=0;
    c=0;
    if(b==a-1)
    {
        int i=1;
       while(i<=a)
       {
           if(i%2==0)
           {
               cout<<ar[a-i+1]<<" ";
           }
           else
           {
               cout<<ar[i]<<" ";
           }
           i++;
       }
    }
    else
    rep(i,a)cout<<ar[i+1]<<" ";

    return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define fi first
#define se second
#define all(x) x.begin(),x.end()

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}
ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ull a,b,c=0,res=0,sum=0,f=0,ff=0,cnt=0;
string s,ss;
ll ar[100100];
ll mx=0,mn=1<<29;

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    long long asfjasf;
    cin>>n>>m;
    rep(i,n)
    {
        ar[i+1]=i+1;
    }
    int i=1;
    int ii=0;
    map<int,int>mpp;
    mpp.clear();
    while(i<m and i<=n)
    {
        if(mpp[ar[n-ii]]==0)
        {
        cout<<ar[n-ii]<<" ";
         mpp[ar[n-ii]]=1;
        }
          if(mpp[ar[i]]==0)
          {
        cout<<ar[i]<<" ";
        mpp[ar[i]]=1;
          }
        ii++;
        i++;
    }
    for(int i=1;i<=n;i++)
    {
        if(mpp[i]==0)
            cout<<i<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define fi first
#define se second
#define all(x) x.begin(),x.end()

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}
ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ull a,b,c=0,res=0,sum=0,f=0,ff=0,cnt=0;
string s,ss;
ll ar[100100];
ll mx=0,mn=1<<29;

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    long long asfjasf;
    cin>>n>>m;
    rep(i,n)
    {
        ar[i+1]=i+1;
    }
    int i=1;
    int ii=0;
    map<int,int>mpp;
    mpp.clear();
    while(i<=(m/2) and i<=n)
    {
        if(mpp[ar[n-ii]]==0)
        {
        cout<<ar[n-ii]<<" ";
         mpp[ar[n-ii]]=1;
        }
          if(mpp[ar[i]]==0)
          {
        cout<<ar[i]<<" ";
        mpp[ar[i]]=1;
          }
        ii++;
        i++;
    }
    for(int i=1;i<=n;i++)
    {
        if(mpp[i]==0)
            cout<<i<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>

typedef long long int ll;
typedef unsigned long long int ull;

#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}

ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}

ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ll a,b,c,res=0,sum=0,f=0,ff=0,cnt=0;
ll ar[100100];
string s,ss;
int main()
{
    ios_base::sync_with_stdio(false);
    cin>>a>>b;
    int cnt=1;
    for(int i=1;i<=a;i++)
    {
        ar[i]=i;
        if(i>2 and cnt<b)
        {
            swap(ar[i],ar[i-1]);
            cnt++;
        }
    }
    rep(i,a)cout<<ar[i+1]<<" ";

    return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define fi first
#define se second
#define all(x) x.begin(),x.end()

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}
ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ull a,b,c=0,res=0,sum=0,f=0,ff=0,cnt=0;
string s,ss;
ll ar[100100];
ll mx=0,mn=1<<29;

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    long long asfjasf;
    cin>>n>>m;
    rep(i,n)
    {
        ar[i+1]=i+1;
    }
    int i=1;
    int ii=0;
    map<int,int>mpp;
    mpp.clear();
    while(i<m and i<=n)
    {
        if(mpp[ar[n-ii]]==0)
        {
        cout<<ar[n-ii]<<" ";
         mpp[ar[n-ii]]=1;
        }
          if(mpp[ar[i]]==0)
          {
        cout<<ar[i]<<" ";
        mpp[ar[i]]=1;
          }
        ii++;
        i++;
    }
    for(int i=1;i<=n;i++)
    {
        if(mpp[i]==0)
            cout<<i<<" alhela ";
    }
    return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define pb push_back
#define mp make_pair
#define len(s) s.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define fi first
#define se second
#define all(x) x.begin(),x.end()

using namespace std;

ll gcd(ll x,ll y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
ll bigMod(ll a,ll b)
{
      if(!b) return 1;
      ll x = bigMod(a,b/2);
      ll temp = (x*x)%mod;
      if(b%2) temp = (temp*a)%mod;
      return temp;
}
ll modinv(ll a)
{
      return bigMod(a,mod-2);
}
ull a,b,c=0,res=0,sum=0,f=0,ff=0,cnt=0;
string s,ss;
ll ar[100100];
ll mx=0,mn=1<<29;

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    long long asfjasf;
    cin>>n>>m;
    rep(i,n)
    {
        ar[i+1]=i+1;
    }
    int i=1;
    int ii=0;
    map<int,int>mpp;
    while(i<m and i<=n)
    {
        cout<<ar[n-ii]<<" ";
        cout<<ar[i]<<" ";
        mpp[ar[n-ii]]=1;
        mpp[ar[i]]=1;
        ii++;
        i++;
    }
    for(int i=1;i<=n;i++)
    {
        if(mpp[i]==0)
            cout<<i<<" ";
    }
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main (){
    int x,y;
    cin >> x >> y;
    int a=1,b=y,z=x;
    if (y >1){
    for (int i = 0; i < y; i++)
    {
        if(i%2==0) cout<< a++ << " ";
        else cout<< x--<< " ";
    }
    for (int i = 0; i < z-y; i++)
    {
        cout << x<< " ";
        x--;
    }

}
    else
    {
        for (int i = 1; i <=x ; i++)
        cout << i << " ";
    }

}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main (){
    int x,y;
    cin >> x >> y;
    int a=1,b=y,z=x;
    for (int i = 0; i < y; i++)
    {
        if(i%2==0) cout<< a++ << " ";
        else cout<< x--<< " ";
    }
    for (int i = 0; i < z-y; i++)
    {
        cout << x<< " ";
        x--;
    }

}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main (){
    int x,y;
    cin >> x >> y;
    int a=1,b=y,z=x;
    if (x-y >1){
    for (int i = 0; i < y; i++)
    {
        if(i%2==0) cout<< a++ << " ";
        else cout<< x--<< " ";
    }
    for (int i = 0; i < z-y; i++)
    {
        cout << x<< " ";
        x--;
    }

}
    else
    {
        for (int i = 1; i <=x ; i++)
        cout << i << " ";
    }

}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main (){
	int x,y;
	cin >> x >> y;
	int a=1,b=y,z=x;
	if (y >1){
	for (int i = 0; i < y; i++)
	{
		if(i%2==0) cout<< a++ << " ";
		else cout<< x--<< " ";
	}
	for (int i = 0; i < z-y; i++)
	{
		if (y%2==0)
		{
			cout << x<< " ";
		x--;
		}
		else
		{
			cout << a<< " ";
		a++;
		}
	}

}
	else
	{
		for (int i = 1; i <=x ; i++)
		cout << i << " ";
	}

}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <stdio.h>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <limits.h>
#define ll long long int
#define mod 1000000009
using namespace std;

bool visited[100010];
vector<int>v;
int main()
{

//  freopen("C:\\Users\\jack\\Desktop\\in.txt","r",stdin);
 //freopen("C:\\Users\\jack\\Desktop\\out.txt","w",stdout);

    int test;
      ll x,y;
    while(cin>>x)
    {
       cin>>y;

       int val=1;
       v.clear();

       for(int i=1;i<=x;i++)visited[i]=false;

       int flag=0;
       while(y)
       {
         v.push_back(val);
         visited[val]=true;

         if(flag==0){val+=y;}
         else val-=y;

         flag^=1;
         y--;

         }
         for(int i=1;i<=x;i++)if(visited[i]==false)v.push_back(i);

          for(int i=0;i<v.size();i++)cout<<v[i]<<" ";

                 }

    }


#include<iostream>
#include<vector>
using namespace std;
vector<int>vec;
bool flag[100010];
int main()
{
	int n,k,i=1,temp;

	cin>>n>>k;

	vec.push_back(n);
	temp=n;
	flag[temp]=true;
	while(k)
	{
	   	if(i&1)
	   	   vec.push_back(temp-k),temp=temp-k,flag[temp]=true;
	   	   else
	   	   vec.push_back(temp+k),temp=temp+k,flag[temp]=true;

	   	   k--;
	   	   i++;

	}
	for(int i=n;i>=1;i--)if(!flag[i])vec.push_back(i);

	for(int i=0;i<n;i++)
	cout<<vec[i]<<" ";
	cout<<endl;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<limits.h>
#include<list>
#include<cmath>
#include<string>
#include<cstring>
#include<sstream>
#include<map>
#include<cstdlib>
#define LL  long long
#define ULL unsigned long long
#define sd(a) scanf("%d",&(a))
#define pb(a) push_back(a)
using namespace std;
int arr[100005],diff[100005];
vector<int> v;
int main(){
//freopen("C:\\Users\\jack\\Desktop\\in.txt","r",stdin);
 //freopen("C:\\Users\\jack\\Desktop\\out.txt","w",stdout);

int n,k,u,p;
cin>>n>>k;
v.pb(1);
u=k;
arr[1]=1;
int i=1;
while(i<n){
    if(u<=0) u=k;
 if((i%2)){
  p=v[i-1]+u;
  if(arr[p] || p>n) {
  while(arr[p] || p>n ) {
  u--;p=v[i-1]+u;
}
}
//cout<<u<<" "<<p<<"\n";
  v.pb(p);
  arr[p]=1;
  i++;
}
 else{
  p=v[i-1]-u;
if(p<1 || arr[p])
  while(p<1 || arr[p]) {
  u--;p=v[i-1]-u;
}
  v.pb(p);
  arr[p]=1;
  i++;

}

u--;
}
for(int i=0;i<n;i++) cout<<v[i]<<" ";
cout<<"\n";
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<limits.h>
#include<list>
#include<cmath>
#include<string>
#include<cstring>
#include<sstream>
#include<map>
#include<cstdlib>
#define LL  long long
#define ULL unsigned long long
#define sd(a) scanf("%d",&(a))
#define pb(a) push_back(a)
using namespace std;
int arr[100005],diff[100005];
vector<int> v;
int main(){
//freopen("C:\\Users\\jack\\Desktop\\in.txt","r",stdin);
 //freopen("C:\\Users\\jack\\Desktop\\out.txt","w",stdout);

int n,k,u,p;
cin>>n>>k;
v.pb(1);
u=k;
arr[1]=1;
int i=1;
while(i<n){
    if(u<=0) break;
 if((i%2)){
  p=v[i-1]+u;
  if(arr[p] || p>n) {
  while(arr[p] || p>n ) {
  u--;p=v[i-1]+u;
}
}
//cout<<u<<" "<<p<<"\n";
  v.pb(p);
  arr[p]=1;
  i++;
}
 else{
  p=v[i-1]-u;
if(p<1 || arr[p])
  while(p<1 || arr[p]) {
  u--;p=v[i-1]-u;
}
  v.pb(p);
  arr[p]=1;
  i++;

}

u--;
}
for(int i=1;i<=n;i++) if(!arr[i]) v.pb(i);
for(int i=0;i<n;i++) cout<<v[i]<<" ";
cout<<"\n";
}


#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int arr[300001];
int main(){
    int n, k, n1, n2, temp, temp2, temp3;
    bool b = true;
    cin >> n >> k;
    n1 = 1;
    n2 = 1;
    temp = k;
    temp2 = n;
    temp3 = n;
    for (int i = 1; i < 300001; i++){arr[i]=i;};
    arr[1] = -1;
    if (k == 1){
        for (int i = 1; i <= n; i++){
            cout << i << " ";
        }
    }
    else{
        while(n--){
            cout << n1 << " ";
            if (k > 0){
                if (b){
                    n1 = temp3;
                    arr[n1] = -1;
                    temp3--;
                    b = false;
                    k--;
                }
                else{
                    n2++;
                    n1 = n2;
                    arr[n1] = -1;
                    b = true;
                    k--;
                }
            }
            else{
                if (temp%2){
                    for (int i = temp2; i > 0; i++){
                        if (arr[i] != -1){
                            n1 = arr[i];
                            arr[i] = -1;
                            break;
                        }
                    }
                }
                else{
                    for (int i = 1; i <= temp2; i++){
                        if (arr[i] != -1){
                            n1 = arr[i];
                            arr[i] = -1;
                            break;
                        }
                    }
                }
            }
        }
    }
    return 0;
}


#include<iostream>

using namespace std;

int main(){
    int n, k, p, temp, cicle;
    cin >> n >> k;
    temp = k;
    p = 1;
    cicle = 0;
    while(n--){
        cout << p << " ";
        p+=temp;
        temp--;
        if(temp == 0){
            temp = k;
        }
    }
    return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int arr[300001];
int main(){
    int n, k, p, temp, cicle, cnt = 0, n1, n2;
    bool one = true;
    cin >> n >> k;
    temp = k;
    n1 = 1;
    for (int i = 1; i < 300001; i++){arr[i]=i;};
    arr[1] = -1;
    while(n--){
        cout << n1 << " ";
        for (int i = n1-temp; i <= n1+temp; i++){
            if (i <= 0) continue;
            else if (arr[i] == -1) continue;
            if (abs(arr[i]-n1) == temp){
                n1 = arr[i];
                arr[i] = -1;
                break;
            }
        }
        temp--;
        if(temp == 0){
            temp = k;
        }
    }
    return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int arr[300001];
int main(){
    int n, k, n1, n2, temp, temp2, temp3;
    bool b = true;
    cin >> n >> k;
    n1 = 1;
    n2 = 1;
    temp = k;
    temp2 = n;
    temp3 = n;
    for (int i = 1; i < 300001; i++){arr[i]=i;};
    arr[1] = -1;
    if (k == 1){
        for (int i = 1; i <= n; i++){
            cout << i << " ";
        }
    }
    else{
        while(n--){
            cout << n1 << " ";
            if (k > 1){
                if (b){
                    n1 = temp3;
                    arr[n1] = -1;
                    temp3--;
                    b = false;
                    k--;
                }
                else{
                    n2++;
                    n1 = n2;
                    arr[n1] = -1;
                    b = true;
                    k--;
                }
            }
            else{
                if (temp%2 == 0){
                    for (int i = temp2; i > 0; i--){
                        if (arr[i] != -1){
                            n1 = arr[i];
                            arr[i] = -1;
                            break;
                        }
                    }
                }
                else{
                    for (int i = 1; i <= temp2; i++){
                        if (arr[i] != -1){
                            n1 = arr[i];
                            arr[i] = -1;
                            break;
                        }
                    }
                }
            }
        }
    }
    return 0;
}


#include<iostream>

using namespace std;

int main(){
    int n, k, p, temp, cicle;
    bool take = false;
    cin >> n >> k;
    temp = k;
    p = 1;
    cicle = 1;
    while(n--){
        cout << p << " ";
        p+=temp;
        temp--;
        if(temp == 0){
            temp = k;
        }
    }
    return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int arr[300001];
int main(){
    int n, k, n1, n2, temp, temp2, temp3;
    bool b = true;
    cin >> n >> k;
    n1 = 1;
    n2 = 1;
    temp = k;
    temp2 = n;
    temp3 = n;
    for (int i = 1; i < 300001; i++){arr[i]=i;};
    arr[1] = -1;
    if (k == 1){
        for (int i = 1; i <= n; i++){
            cout << i << " ";
        }
    }
    else{
        while(n--){
            cout << n1 << " ";
            if (k > 1){
                if (b){
                    n1 = temp3;
                    arr[n1] = -1;
                    temp3--;
                    b = false;
                    k--;
                }
                else{
                    n2++;
                    n1 = n2;
                    arr[n1] = -1;
                    b = true;
                    k--;
                }
            }
            else{
                if (temp%2 == 0){
                    for (int i = temp2; i > 0; i--){
                        if (n == 0) break;
                        if (arr[i] != -1){
                            cout << arr[i] << " ";
                            arr[i] = -1;
                            n--;
                        }
                    }
                }
                else{
                    for (int i = 1; i <= temp2; i++){
                        if (n == 0) break;
                        if (arr[i] != -1){
                            cout << arr[i] << " ";
                            arr[i] = -1;
                            n--;
                        }
                    }
                }
            }
        }
    }
    return 0;
}


#include<math.h>
#include<vector>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,e,k;
    vector <int> c,d;
    cin>>a>>b;
    e=a;
    for(int i=0;i<a;i++)
        c.push_back(i+1);
    for(int i=a-1;i>0;i--)
        if(a-i<b)
            d.push_back(i);
        else
            d.push_back(1);
    cout<<a<<' ';
    k=a;
    for(int i=0;i<a-1;i++)
    {
        if((d[i]==1 && d[i]+e<k)|| e<=d[i])
        {
            e+=d[i];
            if(e==k-1)
                k=e;
        }
        else
            e-=d[i];
        cout<<e<<' ';
    }
    return 0;
}


#include<math.h>
#include<vector>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,d=1,e;
    vector <int> c;
    cin>>a>>b;
    for(int i=0;i<a;i++)
        c.push_back(i+1);
    for(int i=0;i<a;i++)
    {
        if(b>0)
        {
            if(i%2==0)
            {
                e=a-i/2;
                cout<<e<<' ';
                d=0;
            }
            else
            {
                e=(i/2)+1;
                cout<<e<<' ';
                d=1;
            }
            b--;
        }
        else
        {
            if(d==0)
                cout<<--e<<' ';
            else
                cout<<++e<<' ';
        }
    }
    return 0;
}


#include<math.h>
#include<vector>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,e,k,m=0;
    vector <int> c,d;
    cin>>a>>b;
    e=a;
    for(int i=0;i<a;i++)
        c.push_back(i+1);
    for(int i=a-1;i>0;i--)
        if(a-i<b)
            d.push_back(i);
        else
            d.push_back(1);
    cout<<a<<' ';
    for(int i=0;i<a-1;i++)
    {
        if(d[i]!=1)
        {
            if(i%2==1)
            {
                cout<<a-ceil(i/2.)<<' ';
                k=a-ceil(i/2.);
            }
            else
            {
                cout<<i/2+1<<' ';
                k=i/2+1;
            }
        }
        else
        {
            if(a-ceil(i/2.)>k && m==0)
                m=1;
            else
                m=2;
            if(m==1)
                cout<<++k<<' ';
            else
                cout<<--k<<' ';
        }
    }
    return 0;
}


#include<math.h>
#include<vector>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,e;
    bool p;
    vector <int> c,d,k;
    cin>>a>>b;
    e=a;
    for(int i=0;i<a;i++)
        c.push_back(i+1);
    for(int i=a-1;i>0;i--)
        if(a-i<b)
            d.push_back(i);
        else
            d.push_back(1);
    cout<<a<<' ';
    k.push_back(a);
    for(int i=0;i<a-1;i++)
    {
        p=0;
        for(int j=0;j<k.size();j++)
            if(k[j]==d[i]+e)
                p=1;
        if(((d[i]==1 && d[i]+e<a && p==0)|| e<=d[i]))
        {
            e+=d[i];
        }
        else
            e-=d[i];
        k.push_back(e);
        cout<<e<<' ';
    }
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    int n, k, now = 1, last;
    cin >> n >> k, last = n;
    if (k == 2){
        cout << 1 << " " << 3 << " " << 2 << " ";
        Rep(i, 4, n + 1) cout << i << " ";
        cout << endl;
        return 0;
    }
    k >>= 1;
    while (k--) cout << now << " " << last << " ", last--, now++;
    Rep(i, now, last + 1) cout << i << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define RRep(i, j, k) for (ll i = k; i >= j; i--)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    int n, k, l = 1, &r = n, ys;
    scanf("%d%d", &n, &k);
    ys = k & 1, k >>= 1;
    while (k--) printf("%d %d ", l, r), r--, l++;
    if (ys) Rep(i, l, r + 1) printf("%d ", i);
    else RRep(i, l, r) printf("%d ", i);
    printf("\n");
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define RRep(i, j, k) for (ll i = k; i >= j; i--)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    int r, k, l = 1, ys;
    scanf("%d%d", &r, &k);
    ys = k & 1, k >>= 1;
    while (k--) printf("%d %d ", l, r), r--, l++;
    if (ys) Rep(i, l, r + 1) printf("%d ", i);
    else RRep(i, l, r) printf("%d ", i);
    printf("\n");
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    ll n, k, now = 1, last;
    cin >> n >> k, last = n;
    if (k == 2){
        cout << 1 << " " << 3 << " " << 2 << " ";
        Rep(i, 4, n + 1) cout << i << " ";
        cout << endl;
        return 0;
    }
    k >>= 1;
    while (k--) cout << now << " " << last << " ", last--, now++;
    Rep(i, now, last + 1) cout << i << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    ll n, k, now = 1, last;
    cin >> n >> k, last = n;
    if (k == 2){
        cout << 1 << " " << 3 << " " << 2 << " ";
        Rep(i, 4, n + 1) cout << i << " ";
        cout << endl;
        return 0;
    }
    k >>= 1;
    while (k--) cout << now << " " << last << " ", last--, now++;
    for (int i=last;i>=now;i--) cout << i << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    ll n, k, now = 1, last;
    cin >> n >> k, last = n;
    k = k / 2;
    while (k) cout << now << " " << last << " ", last--, now++, k--;
    Rep(i, now, last + 1) cout << i << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    int n, k, now = 1, last;
    cin >> n >> k, last = n;
    if (k == 2){
        cout << 1 << " " << 3 << " " << 2 << " ";
        Rep(i, 4, n + 1) cout << i << " ";
        cout << endl;
        return 0;
    }
    k >>= 1;
    while (k) cout << now << " " << last << " ", last--, now++, k--;
    Rep(i, now, last + 1) cout << i << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    ll n, k, now = 1, last;
    cin >> n >> k, last = n;
    if (k == 2){
        cout << 1 << " " << 3 << " " << 2 << " ";
        Rep(i, 4, n + 1) cout << i << " ";
        cout << endl;
        return 0;
    }
    k = k / 2;
    while (k) cout << now << " " << last << " ", last--, now++, k--;
    Rep(i, now, last + 1) cout << i << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) scanf("%d%d", &N.first, &N.second)
#define coutp(N) printf("%d %d\n", N.first, N.second)
#define co(x) cout<<x<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < int(j); i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define RRep(i, j, k) for (ll i = k; i >= j; i--)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9+1

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

ll gcd(int x, int y){ return !y ? (ll)x : (ll)gcd(y, x%y); }

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, k, len, idx;
    cin >> n >> k;
    vi array(n), ans, add;
    rep(i, n) array[i] = i + 1;
    for (int i = 0; i < k / 2; i++) ans.push_back(array[i]), ans.push_back(array[n - i - 1]);
    Rep(i, k / 2, n - k / 2) add.push_back(array[i]);
    if (!(k & 1)) reverse(all(add));
    rep(i, siz(add)) ans.push_back(add[i]);
    rep(i, n) cout << ans[i] << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    ll n, k, now = 1, ran, add = 1;
    cin >> n >> k;
    rep(i, n){
        if (k) k--, cout << now << " ", now += add, add++;
        else cout << now << " ", now += add-1;
    }
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define RRep(i, j, k) for (ll i = k; i >= j; i--)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    ll n, k, now = 1, last, ys;
    cin >> n >> k, last = n;
    if (k == 2){
        cout << 1 << " " << 3 << " " << 2 << " ";
        Rep(i, 4, n + 1) cout << i << " ";
        cout << endl;
        return 0;
    }
    ys = k & 1, k >>= 1;
    while (k--) cout << now << " " << last << " ", last--, now++;
    if (ys) Rep(i, now, last + 1) cout << i << " ";
    else RRep(i, now, last) cout << i << " ";
    cout << endl;
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) scanf("%d%d", &N.first, &N.second)
#define coutp(N) printf("%d %d\n", N.first, N.second)
#define co(x) cout<<x<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < int(j); i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define RRep(i, j, k) for (ll i = k-1; i >= j; i--)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9+1

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

ll gcd(int x, int y){ return !y ? (ll)x : (ll)gcd(y, x%y); }

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, k, len, idx = 0;
    scanf("%d%d", &n, &k), len = k >> 1;
    vi array(n), ans(n);
    rep(i, n) array[i] = i + 1;
    rep(i, len) ans[idx++] = array[i], ans[idx++] = array[n - i - 1];
    if (!(k & 1)) reverse(array.begin() + len, array.begin() + n - len);
    Rep(i, len, n - len) ans[idx++] = array[i];
    rep(i, n) printf(i != n - 1 ? "%d " : "%d\n", ans[i]);
    return 0;
}


//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <cstring>
#include <fstream>
#include <functional>
#include <cstdio>
#include <stack>
#include <utility>
#include <set>
#include <list>
#include <queue>
#include <bitset>
using namespace std;

#define all(S) S.begin(), S.end()
#define sortb(S) sort(S.rbegin(), S.rend())
#define sorta(S) sort(all(S))
#define cinp(N) cin>>N.first>>N.second
#define coutp(N) cout<<N.first<<" "<<N.second<<endl
#define mem(C, V) memset(C, V, sizeof C)
#define clr(S, V) fill(all(S), V)
#define ssum(N) (ll)N*(N+1)/2
#define gt(S) getline(cin, S)
#define sp(N) setprecision(N)<<fixed
#define siz(S) S.size()
#define mk make_pair
#define go continue
#define rep(i, j) for (ll i = 0; i < j; i++)
#define rrep(i, j) for (ll i = j - 1; i > -1; i--)
#define getdis(x1, y1, x2, y2) double(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)))
#define Rep(i, j, k) for (ll i = j; i < k; i++)
#define srep(C) for (decltype(C.begin()) it = C.begin(); it != C.end(); it++)
#define pi 3.1415926535897932384626433832795
#define ex 2.7182818284
#define mod 1000000007
#define oo (ll) 2e9

typedef stringstream ss;
typedef string s;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<s> vs;
typedef map<ll, ll> mii;
typedef map<char, ll> mci;
typedef map<s, ll> msi;

int main(){
    //freopen("input.txt", "r", stdin)n)
    //freopen("output.txt", "w", stdout)
    ll n, k;
    cin >> n >> k, k--;
    vi array(n);
    rep(i, n) array[i] = i + 1;
    Rep(i, 1, n - 1){
        if (k) swap(array[i], array[i + 1]), k--;
    }
    rep(i, n) cout << array[i] << " ";
    cout << endl;
    return 0;
}