import java.io.PrintWriter;
import java.util.*;

public class A393 {
	public static int min(int a, int b) {
		if(a < b) return a;
		else return b;
	}

	public static int max(int a, int b) {
		if(a > b) return a;
		else return b;
	}

	public static int N,K,T[] = new int[9000099];

	public static long sum(int v, int tl, int tr, int l, int r) {
		if(l > r) return 0;
		else if(tl == l && tr == r) return T[v];
		else {
			int tm = (tl+tr)/2;
			long left = sum(v*2, tl, tm, l, min(r,tm));
			long right = sum(v*2+1, tm+1, tr, max(l,tm+1), r);
			return left + right;
		}
	}
	public static void update(int v, int tl, int tr, int pos, long val) {
		if(tl ==  tr) T[v] += val;
		else {
			int tm = (tl+tr)/2;
			if(pos <= tm) update(v*2, tl, tm, pos, val);
			else          update(v*2+1, tm+1, tr, pos, val);
			T[v] = T[v*2] + T[v*2+1];
		}
	}

	public static void main(String [] args) {
		Scanner cin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		N = cin.nextInt();
		K = cin.nextInt();
		if(K > N/2) K = N-K;
		int cur = 1;
		long ans = 1;
		for(int i=1; i<=N; i++) {
			int prev = cur;
			cur += K;
			if(cur > N) cur -= N;
			if(prev <= cur) {
				long s = sum(1,1,N,prev+1, cur-1);
				out.printf("%d ", ans+s+1);
//				cout << ans + s + 1 << " ";
				ans += s + 1;
				update(1,1,N,prev,1);
				update(1,1,N,cur,1);
			}
			else {
			    long s = sum(1,1,N,prev+1, N) + sum(1,1,N,1,cur-1);
			//	cout << prev+1 << " " << N << " === " << 1 << " " << cur-1 << endl;
				out.printf("%d ", ans+s+1);
//				cout << ans + s +1 << " ";
				ans += s + 1;
				update(1,1,N,prev,1);
				update(1,1,N,cur,1);
			}
	//		cout << prev << " " << cur << endl;
		//	if(i > 9) break;
		}
		out.flush();
	}
}


import java.io.PrintWriter;
import java.util.*;

public class D755 {
	public static int min(int a, int b) {
		if(a < b) return a;
		else return b;
	}

	public static int max(int a, int b) {
		if(a > b) return a;
		else return b;
	}

	public static int N,K,T[] = new int[9000099];

	public static long sum(int v, int tl, int tr, int l, int r) {
		if(l > r) return 0;
		else if(tl == l && tr == r) return T[v];
		else {
			int tm = (tl+tr)/2;
			long left = sum(v*2, tl, tm, l, min(r,tm));
			long right = sum(v*2+1, tm+1, tr, max(l,tm+1), r);
			return left + right;
		}
	}
	public static void update(int v, int tl, int tr, int pos, long val) {
		if(tl ==  tr) T[v] += val;
		else {
			int tm = (tl+tr)/2;
			if(pos <= tm) update(v*2, tl, tm, pos, val);
			else          update(v*2+1, tm+1, tr, pos, val);
			T[v] = T[v*2] + T[v*2+1];
		}
	}

	public static void main(String [] args) {
		Scanner cin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		N = cin.nextInt();
		K = cin.nextInt();
		if(K > N/2) K = N-K;
		int cur = 1;
		long ans = 1;
		for(int i=1; i<=N; i++) {
			int prev = cur;
			cur += K;
			if(cur > N) cur -= N;
			if(prev <= cur) {
				long s = sum(1,1,N,prev+1, cur-1);
				out.printf("%d ", ans+s+1);
//				cout << ans + s + 1 << " ";
				ans += s + 1;
				update(1,1,N,prev,1);
				update(1,1,N,cur,1);
			}
			else {
			    long s = sum(1,1,N,prev+1, N) + sum(1,1,N,1,cur-1);
			//	cout << prev+1 << " " << N << " === " << 1 << " " << cur-1 << endl;
				out.printf("%d ", ans+s+1);
//				cout << ans + s +1 << " ";
				ans += s + 1;
				update(1,1,N,prev,1);
				update(1,1,N,cur,1);
			}
	//		cout << prev << " " << cur << endl;
		//	if(i > 9) break;
		}
		out.flush();
	}
}


import java.util.*;
public class satyam
{
    public static void main(String args[])
    {
        Scanner ex=new Scanner(System.in);
        int n=ex.nextInt();
        int k=ex.nextInt();
        if(k>(n/2))
        k=n-k;
        int quo=n/k;
        long i,add=1;
        for(i=2;i<=(quo+1);i++)
        System.out.print(i+" ");
        i--;
        int pos=1+k*quo;
        int count=quo;
        while(count<n)
        {
            add++;
            i=i+add;
            System.out.print(i+" ");
            add++;
            pos=pos+k-n;
            for(int j=1;j<quo;j++)
            {
                i=i+add;
                System.out.print(i+" ");
            }
            pos=pos+k*(quo-1);
            if((pos+k)<=n)
            {
                i=i+add;
                System.out.print(i+" ");
                count++;
                pos=pos+k;
            }
            count=count+quo;
            if(count==(n-1))
            {
                System.out.print(i+add);
                count++;
            }
        }
    }
}


import java.util.*;
public class satyam
{
    public static void main(String args[])
    {
        Scanner ex=new Scanner(System.in);
        int n=ex.nextInt();
        int k=ex.nextInt();
        int quo=n/k;
        long i,add=1;
        for(i=2;i<=(quo+1);i++)
        System.out.print(i+" ");
        i--;
        int pos=1+k*quo;
        int count=quo;
        while(count<n)
        {
            add++;
            i=i+add;
            System.out.print(i+" ");
            add++;
            pos=pos+k-n;
            for(int j=1;j<quo;j++)
            {
                i=i+add;
                System.out.print(i+" ");
            }
            pos=pos+k*(quo-1);
            if((pos+k)<=n)
            {
                i=i+add;
                System.out.print(i+" ");
                count++;
                pos=pos+k;
            }
            count=count+quo;
            if(count==(n-1))
            {
                System.out.print(i+add);
                count++;
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Temp {

	public static void main(String[] args) throws Throwable{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		boolean[] vis = new boolean[n+1];
		long sections = 1;
		int u = 1;
		StringBuilder sb = new StringBuilder();
		SegmentTree tree = new SegmentTree(n);
		while(!vis[u])
		{
			vis[u] = true;
			int v = u+k;
			if(v>n)v-=n;
			long curSections;
			if(k<=n>>1)
			{
				if(v<u)curSections = 1 + tree.query(u+1, n) + tree.query(1, v-1);
				else curSections = 1 + tree.query(u+1, v-1);
			}
			else
			{
				if(v<u)curSections = 1 + tree.query(v+1, u-1);
				else curSections = 1 + tree.query(1,u-1) + tree.query(v+1, n);
			}
			sections += curSections;
			sb.append(sections+" ");
			tree.update(u);
			tree.update(v);
			u = v;
		}
		System.out.println(sb);
	}

	static class SegmentTree
	{
		int[] tree;
		int n;

		public SegmentTree(int size)
		{
			n = size;
			int N = 1;
			while(N<size)N<<=1;
			N<<=1;
			tree = new int[N];
		}

		void update(int p) {update(1, 1, n, p);}

		void update(int n,int l,int r,int p)
		{
			if(l>p||r<p)return;
			if(l==p&&r==p)++tree[n];
			else
			{
				int mid = (l+r)>>1;
				update(n<<1, l, mid, p);
				update(n<<1|1, mid+1, r, p);
				tree[n] = tree[n<<1] + tree[n<<1|1];
			}
		}

		int query(int i, int j)
		{
			if(i>j || i>n || j>n)
				return 0;
			return query(1,1,n,i,j);
		}

		int query(int node, int b, int e, int i, int j)
		{
			if(i>e || j <b)
				return 0;
			if(b>= i && e <= j)
				return tree[node];
			int mid = b + e >> 1;
			int q1 = query(node<<1,b,mid,i,j);
			int q2 = query(node<<1|1,mid+1,e,i,j);
			return q1 + q2;

		}
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String s) throws FileNotFoundException {br = new BufferedReader(new FileReader(s));}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public String nextLine() throws IOException {return br.readLine();}
		public long nextLong() throws IOException {return Long.parseLong(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public char nextChar() throws IOException{return next().charAt(0);}
		public boolean ready() throws IOException {return br.ready();}
		public int[] nextIntArr() throws IOException{
			st = new StringTokenizer(br.readLine());
			int[] res = new int[st.countTokens()];
			for (int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}
		public char[] nextCharArr() throws IOException{
			st = new StringTokenizer(br.readLine());
			char[] res = new char[st.countTokens()];
			for (int i = 0; i < res.length; i++)
				res[i] = nextChar();
			return res;
		}
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Temp {

	public static void main(String[] args) throws Throwable{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		boolean[] vis = new boolean[n+1];
		long sections = 1;
		int u = 1;
		StringBuilder sb = new StringBuilder();
		SegmentTree tree = new SegmentTree(n);
		while(!vis[u])
		{
			vis[u] = true;
			int v = u+k;
			if(v>n)v-=n;
			long curSections;
			if(v<u)
				curSections = 1+ tree.query(u+1, n) + tree.query(1, v-1);
			else
				curSections = 1 + tree.query(u+1, v-1);
			sections += curSections;
			sb.append(sections+" ");
			tree.update(u);
			tree.update(v);
			u = v;
		}
		System.out.println(sb);
	}

	static class SegmentTree
	{
		int[] tree;
		int n;

		public SegmentTree(int size)
		{
			n = size;
			int N = 1;
			while(N<size)N<<=1;
			N<<=1;
			tree = new int[N];
		}

		void update(int p) {update(1, 1, n, p);}

		void update(int n,int l,int r,int p)
		{
			if(l>p||r<p)return;
			if(l==p&&r==p)++tree[n];
			else
			{
				int mid = (l+r)>>1;
				update(n<<1, l, mid, p);
				update(n<<1|1, mid+1, r, p);
				tree[n] = tree[n<<1] + tree[n<<1|1];
			}
		}

		int query(int i, int j)
		{
			if(i>j || i>n || j>n)
				return 0;
			return query(1,1,n,i,j);
		}

		int query(int node, int b, int e, int i, int j)
		{
			if(i>e || j <b)
				return 0;
			if(b>= i && e <= j)
				return tree[node];
			int mid = b + e >> 1;
			int q1 = query(node<<1,b,mid,i,j);
			int q2 = query(node<<1|1,mid+1,e,i,j);
			return q1 + q2;

		}
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String s) throws FileNotFoundException {br = new BufferedReader(new FileReader(s));}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public String nextLine() throws IOException {return br.readLine();}
		public long nextLong() throws IOException {return Long.parseLong(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public char nextChar() throws IOException{return next().charAt(0);}
		public boolean ready() throws IOException {return br.ready();}
		public int[] nextIntArr() throws IOException{
			st = new StringTokenizer(br.readLine());
			int[] res = new int[st.countTokens()];
			for (int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}
		public char[] nextCharArr() throws IOException{
			st = new StringTokenizer(br.readLine());
			char[] res = new char[st.countTokens()];
			for (int i = 0; i < res.length; i++)
				res[i] = nextChar();
			return res;
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class DVenture {

	public static void main(String[] args) {
		FS scan = new FS(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = scan.nextInt(), K = scan.nextInt();
		K = Math.min(K, N-K);
		long val = 1;
		BIT b = new BIT(N);
		int idx = 0;
		for(int i=0;i<N;i++){
			int lo = (idx+1)%N, hi = (idx+K-1)%N;
			if(lo>hi){
				val+=(b.query(lo+1,N)+b.query(1,hi+1))+1;
			}else{
				val+=b.query(lo+1,hi+1)+1;
			}
			b.update(idx+1, 1);
			b.update((idx+K)%N+1, 1);
			idx = (idx+K)%N;
			out.print(val+" ");
		}out.println();
		out.close();
	}

	private static class BIT {
		long[] ft;
		public BIT(int N) {
			ft = new long[N+1];
		}

		public long query(int a){
			long sum = 0;
			for(int i=a;i>0;i-=i&(-i)){
				sum+=ft[i];
			}
			return sum;
		}
		public long query(int a, int b) {
			return query(b)-query(a-1);
		}
		public void update(int a, long v) {
			for(int i=a;i<ft.length;i+=(i&(-i))){
				ft[i]+=v;
			}
		}
	}
	private static class FS {
		BufferedReader br;
		StringTokenizer st;
		public FS(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		String next(){
			while(st==null||!st.hasMoreElements()){
				try{st = new StringTokenizer(br.readLine());}
				catch(IOException e){e.printStackTrace();}
			}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() { return Double.parseDouble(next());}
	}
}


import javafx.util.Pair;

import java.util.*;

/**
 * Created by Luis Ngo on 4/1/2017.
 */
public class PD {

    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        long n =  scanner.nextInt();
        long k = scanner.nextInt();
        long q = n/k;
        long step = 1;
        long count = 0;
        long r = 2;
        long max = n*k+1;
        for (int i =  0; i <n ; i++ ){
            r = r+step;
            count++;
            if (count == q){
                count = 0;
                step =  step +2;
            } else if (count == 1) r--;

            if (r > max ) r = max;
            System.out.print(r + " ");
        }

    }
}


import java.util.*;

/**
 * Created by Luis Ngo on 4/1/2017.
 */
public class PD {

    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        long n =  scanner.nextInt();
        long k = scanner.nextInt();
        if ( k > n/2) k  = n-k;
//        long q = n/k;
        long step = 1;
        long count = 0;
        long r = 1;
        long start = 1;
        long max = n*k+1;
        for (int i =  0; i <n ; i++ ){
            start = start + k;
            if (start > n+1 ){
                r--;
                start = start%n;
                step = step +2;
            }
            r = r+step;
            System.out.print(r + " ");
        }

    }
}


import java.util.*;

/**
 * Created by Luis Ngo on 4/1/2017.
 */
public class PD {

    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        long n =  scanner.nextInt();
        long k = scanner.nextInt();
        if ( k > n/2) k  = n-k;
        long q = n/k;
        long step = 1;
        long count = 0;
        long r = 2;
        long max = n*k+1;
        for (int i =  0; i <n ; i++ ){
            r = r+step;
            count++;
            if (count == 1) r--;
            if (count == q){
                count = 0;
                step =  step +2;
            }
            if (i == n-1) r--;
            System.out.print(r + " ");
        }

    }
}


import javafx.util.Pair;

import java.util.*;

/**
 * Created by Luis Ngo on 4/1/2017.
 */
public class PD {

    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        long n =  scanner.nextInt();
        long k = scanner.nextInt();
        if ( k > n/2) k  = n-k;
        long q = n/k;
        long step = 1;
        long count = 0;
        long r = 2;
        long max = n*k+1;
        for (int i =  0; i <n ; i++ ){
            r = r+step;
            count++;
            if (count == 1) r--;
            if (count == q){
                count = 0;
                step =  step +2;
            }

            if (r > max ) r = max;
            System.out.print(r + " ");
        }

    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D391vc {
	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		StringBuilder sb = new StringBuilder();
		// ----------My Code----------

		int n = in.nextInt();
		int k = in.nextInt();

		if (k > n / 2)
			k = n - k;
		long ans = 1;
		int cnt = 1;
		int add = 1;
		for (int i = 0; i < n; i++) {
			cnt = cnt + k;
			if (cnt <= n)
				ans += add;
			else {
				ans = ans + (add + 1);
				add += 2;
				cnt = cnt - n;
			}
			if (i == n - 1)
				ans--;
			sb.append(ans+" ");
		}
		System.out.println(sb);
		// ---------------The End------------------

		out.close();
	}

	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D391vc {
	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//StringBuilder sb = new StringBuilder();
		// ----------My Code----------

		int n=in.nextInt();
		int k=in.nextInt();

		if(k>n/2)
	        k = n-k;
		long ans = 1;
	    int cnt = 1;
	    int add = 1;
	    for(int i=0;i<n;i++)
	    {
	        cnt = cnt + k;
	        if(cnt<=n)
	            ans+=add;
	        else
	        {
	            ans = ans + (add+1);
	            add+=2;
	            cnt = cnt-n;
	        }
	        if(i == n-1)
	            ans--;
	        System.out.print(ans+" ");
	    }

		// ---------------The End------------------

		out.close();
	}

	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D391vc {
	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		StringBuilder sb = new StringBuilder();
		// ----------My Code----------

		int n = in.nextInt();
		int k = in.nextInt();

		k = Math.min(k, n - k);
		int curr = 0, cycles = 0;
		long ans = 1;
		for (int i = 0; i < n; i++) {
		    int next = (curr + k)%n;
		    if(next < curr) {
			cycles++;
		    }
		    ans += 2*cycles + (next != 0 ? 1 : 0) + (next < curr ? -1 : 0);
		    curr = next;
		    out.print(ans + " ");
		}

		// ---------------The End------------------

		out.close();
	}

	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}


//package eightvc.e;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class D {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), K = ni();
		if(2*K >= n){
			K = n-K;
		}
		int[] ft = new int[n+3];
		long ret = 1;
		int cur = 0;
		for(int i = 0;i < n;i++){
			int nex = cur+K;
			// [cur-K+1,cur+K-1]
			int pre = cur-K+1;
			if(nex < n){
				if(pre >= 0){
					ret += sumFenwick(ft, nex-1) - sumFenwick(ft, pre-1);
				}else{
					ret += sumFenwick(ft, nex-1) + sumFenwick(ft, n-1) - sumFenwick(ft, pre+n-1);
				}
			}else{
				ret += sumFenwick(ft, n-1) - sumFenwick(ft, pre-1) + sumFenwick(ft, nex-n-1);
			}
			ret++;
			addFenwick(ft, cur, 1);
			while(nex >= n)nex -= n;
			cur = nex;
			out.print(ret + " ");
		}
	}

	public static int[] restoreFenwick(int[] ft)
	{
		int n = ft.length-1;
		int[] ret = new int[n];
		for(int i = 0;i < n;i++)ret[i] = sumFenwick(ft, i);
		for(int i = n-1;i >= 1;i--)ret[i] -= ret[i-1];
		return ret;
	}

	public static int sumFenwick(int[] ft, int i)
	{
		assert i >= -1;
		int sum = 0;
		for(i++;i > 0;i -= i&-i)sum += ft[i];
		return sum;
	}

	public static void addFenwick(int[] ft, int i, int v)
	{
		if(v == 0 || i < 0)return;
		int n = ft.length;
		for(i++;i < n;i += i&-i)ft[i] += v;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new D().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Created by Meepo on 3/11/2017.
 */
public class D {
    public static void main(String[] args) {
        new D().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    int[] f;

    public int get(int x) {
        int ans = 0;
        for (; x >= 0; x = (x & (x + 1)) - 1) {
            ans += f[x];
        }
        return ans;
    }

    public void add(int x, int d) {
        for (; x < f.length; x = x | (x + 1)) {
            f[x] += d;
        }
    }

    public int sum(int x, int k) {
        if (x + k > f.length) {
            int r = x + k - f.length;
            return get(r - 1) + get(f.length - 1) - get(x);
        }
        return get(x + k - 1) - get(x);
    }

    public void solve() throws IOException {
        int n = nextInt();
        int k = nextInt();

        f = new int[n];
        int prevx = 0;
        int x = 0;
        long total = 1;
        for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                add(0, -1);
            }
            total += sum(x, k) + 1;
            out.print(total + " ");
            if (i > 0) {
                add(prevx, 1);
                add(x, 1);
            }
            prevx = x;
            x = x + k >= n ? x + k - n : x + k;
        }
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Created by Meepo on 3/11/2017.
 */
public class D {
    public static void main(String[] args) {
        new D().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    int[] f;

    public int get(int x) {
        int ans = 0;
        for (; x >= 0; x = (x & (x + 1)) - 1) {
            ans += f[x];
        }
        return ans;
    }

    public void add(int x, int d) {
        for (; x < f.length; x = x | (x + 1)) {
            f[x] += d;
        }
    }

    public int sum(int x, int k) {
        if (x + k > f.length) {
            int r = x + k - f.length;
            return get(r - 1) + get(f.length - 1) - get(x);
        }
        return get(x + k - 1) - get(x);
    }

    public void solve() throws IOException {
        int n = nextInt();
        int k = nextInt();
        if (k > n / 2) {
            k = n - k;
        }

        f = new int[n];
        int prevx = 0;
        int x = 0;
        long total = 1;
        for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                add(0, -1);
            }
            total += sum(x, k) + 1;
            out.print(total + " ");
            if (i > 0) {
                add(prevx, 1);
                add(x, 1);
            }
            prevx = x;
            x = x + k >= n ? x + k - n : x + k;
        }
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


import java.io.*;
import java.util.*;

public class Solution {
    private BufferedReader in;
    private StringTokenizer line;
    private PrintWriter out;
    private boolean isDebug;

    public Solution(boolean isDebug) {
        this.isDebug = isDebug;
    }

    public void solve() throws IOException {
        int n = nextInt();
        int k = nextInt();
        if (k > n / 2) {
            k = n - k;
        }
        Tree tree = new Tree(n);
        int cr = 0;
        long res = 1;
        for (int i = 0; i < n; i++) {
            int c = 0;
            int nx = cr + k;
            if (nx <= n) {
                c += tree.sum(cr + 1, nx - 1);
            } else {
                c += tree.sum(cr + 1, n - 1);
                c += tree.sum(0, nx - n - 1);
            }
            c++;
            tree.inc(cr);
            cr = nx % n;
            tree.inc(cr);
            res += c;
            out.print(res + " ");
        }
    }

    private static class Tree {
        private int n;
        private int[] t;

        Tree(int n) {
            this.n = n;
            t = new int[n];
        }

        private int sum(int r) {
            int result = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                result += t[r];
            }
            return result;
        }

        private void inc(int i) {
            for (; i < n; i = (i | (i + 1))) {
                t[i]++;
            }
        }

        private int sum(int l, int r) {
            if (l > r) return 0;
            return sum(r) - sum(l - 1);
        }
    }

    private static final int mm = 1000000007;

    private long mult(long a, long b) {
        return a * b % mm;
    }

    private long pow(long a, int n) {
        if (n == 0) return 1;
        long t = pow(a, n / 2);
        t = mult(t, t);
        if (n % 2 != 0) t = mult(a, t);
        return t;
    }

    public static void main(String[] args) throws IOException {
        new Solution(args.length > 0 && "DEBUG_MODE".equals(args[0])).run(args);
    }

    public void run(String[] args) throws IOException {
        if (isDebug) {
            in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
//            in = new BufferedReader(new InputStreamReader(System.in));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
        }
//        out = new PrintWriter(System.out);
        out = new PrintWriter("output.txt");

//        int t = nextInt();
        int t = 1;
        for (int i = 0; i < t; i++) {
//            out.print("Case #" + (i + 1) + ": ");
            solve();
        }

        in.close();
        out.flush();
        out.close();
    }

    private int[] nextIntArray(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private long[] nextLongArray(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (line == null || !line.hasMoreTokens()) {
            line = new StringTokenizer(in.readLine());
        }
        return line.nextToken();
    }

    private static class Pll {
        private long key;
        private long value;

        public Pll(long key, long value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pll pll = (Pll) o;

            if (key != pll.key) return false;
            return value == pll.value;

        }

        @Override
        public int hashCode() {
            int result = (int) (key ^ (key >>> 32));
            result = 31 * result + (int) (value ^ (value >>> 32));
            return result;
        }
    }

    private static class Pii {
        private int key;
        private int value;

        public Pii(int key, int value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pii pii = (Pii) o;

            if (key != pii.key) return false;
            return value == pii.value;

        }

        @Override
        public int hashCode() {
            int result = key;
            result = 31 * result + value;
            return result;
        }

        @Override
        public String toString() {
            return "Pii{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }

    private static class Pair<K, V> {
        private K key;
        private V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
            return !(value != null ? !value.equals(pair.value) : pair.value != null);

        }

        @Override
        public int hashCode() {
            int result = key != null ? key.hashCode() : 0;
            result = 31 * result + (value != null ? value.hashCode() : 0);
            return result;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }
}


import java.io.*;
import java.util.*;

public class Solution {
    private BufferedReader in;
    private StringTokenizer line;
    private PrintWriter out;
    private boolean isDebug;

    public Solution(boolean isDebug) {
        this.isDebug = isDebug;
    }

    public void solve() throws IOException {
        int n = nextInt();
        int k = nextInt();
        if (k > n / 2) {
            k = n - k;
        }
        Tree tree = new Tree(n);
        int cr = 0;
        long res = 1;
        for (int i = 0; i < 100; i++) {
            int c = 0;
            int nx = cr + k;
            if (nx <= n) {
                c += tree.sum(cr + 1, nx - 1);
            } else {
                c += tree.sum(cr + 1, n - 1);
                c += tree.sum(0, nx - n - 1);
            }
            c++;
            tree.inc(cr);
            cr = nx % n;
            tree.inc(cr);
            res += c;
            out.print(res + " ");
        }
    }

    private static class Tree {
        private int n;
        private int[] t;

        Tree(int n) {
            this.n = n;
            t = new int[n];
        }

        private int sum(int r) {
            int result = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                result += t[r];
            }
            return result;
        }

        private void inc(int i) {
            for (; i < n; i = (i | (i + 1))) {
                t[i]++;
            }
        }

        private int sum(int l, int r) {
            if (l > r) return 0;
            return sum(r) - sum(l - 1);
        }
    }

    private static final int mm = 1000000007;

    private long mult(long a, long b) {
        return a * b % mm;
    }

    private long pow(long a, int n) {
        if (n == 0) return 1;
        long t = pow(a, n / 2);
        t = mult(t, t);
        if (n % 2 != 0) t = mult(a, t);
        return t;
    }

    public static void main(String[] args) throws IOException {
        new Solution(args.length > 0 && "DEBUG_MODE".equals(args[0])).run(args);
    }

    public void run(String[] args) throws IOException {
        if (isDebug) {
            in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
//            in = new BufferedReader(new InputStreamReader(System.in));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
        }
//        out = new PrintWriter(System.out);
        out = new PrintWriter("output.txt");

//        int t = nextInt();
        int t = 1;
        for (int i = 0; i < t; i++) {
//            out.print("Case #" + (i + 1) + ": ");
            solve();
        }

        in.close();
        out.flush();
        out.close();
    }

    private int[] nextIntArray(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private long[] nextLongArray(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (line == null || !line.hasMoreTokens()) {
            line = new StringTokenizer(in.readLine());
        }
        return line.nextToken();
    }

    private static class Pll {
        private long key;
        private long value;

        public Pll(long key, long value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pll pll = (Pll) o;

            if (key != pll.key) return false;
            return value == pll.value;

        }

        @Override
        public int hashCode() {
            int result = (int) (key ^ (key >>> 32));
            result = 31 * result + (int) (value ^ (value >>> 32));
            return result;
        }
    }

    private static class Pii {
        private int key;
        private int value;

        public Pii(int key, int value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pii pii = (Pii) o;

            if (key != pii.key) return false;
            return value == pii.value;

        }

        @Override
        public int hashCode() {
            int result = key;
            result = 31 * result + value;
            return result;
        }

        @Override
        public String toString() {
            return "Pii{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }

    private static class Pair<K, V> {
        private K key;
        private V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
            return !(value != null ? !value.equals(pair.value) : pair.value != null);

        }

        @Override
        public int hashCode() {
            int result = key != null ? key.hashCode() : 0;
            result = 31 * result + (value != null ? value.hashCode() : 0);
            return result;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }
}


import java.io.*;
import java.util.*;

public class Solution {
    private BufferedReader in;
    private StringTokenizer line;
    private PrintWriter out;
    private boolean isDebug;

    public Solution(boolean isDebug) {
        this.isDebug = isDebug;
    }

    public void solve() throws IOException {
        int n = nextInt();
        int k = nextInt();
        Tree tree = new Tree(n);
        int cr = 0;
        long res = 1;
        for (int i = 0; i < n; i++) {
            int c = 0;
            int nx = cr + k;
            if (nx <= n) {
                c += tree.sum(cr + 1, nx - 1);
            } else {
                c += tree.sum(cr + 1, n - 1);
                c += tree.sum(0, nx - n - 1);
            }
            c++;
            tree.inc(cr);
            cr = nx % n;
            tree.inc(cr);
            res += c;
            out.print(res + " ");
        }
    }

    private static class Tree {
        private int n;
        private int[] t;

        Tree(int n) {
            this.n = n;
            t = new int[n];
        }

        private int sum(int r) {
            int result = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                result += t[r];
            }
            return result;
        }

        private void inc(int i) {
            for (; i < n; i = (i | (i + 1))) {
                t[i]++;
            }
        }

        private int sum(int l, int r) {
            if (l > r) return 0;
            return sum(r) - sum(l - 1);
        }
    }

    private static final int mm = 1000000007;

    private long mult(long a, long b) {
        return a * b % mm;
    }

    private long pow(long a, int n) {
        if (n == 0) return 1;
        long t = pow(a, n / 2);
        t = mult(t, t);
        if (n % 2 != 0) t = mult(a, t);
        return t;
    }

    public static void main(String[] args) throws IOException {
        new Solution(args.length > 0 && "DEBUG_MODE".equals(args[0])).run(args);
    }

    public void run(String[] args) throws IOException {
        if (isDebug) {
            in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
//            in = new BufferedReader(new InputStreamReader(System.in));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
        }
        out = new PrintWriter(System.out);
//        out = new PrintWriter("output.txt");

//        int t = nextInt();
        int t = 1;
        for (int i = 0; i < t; i++) {
//            out.print("Case #" + (i + 1) + ": ");
            solve();
        }

        in.close();
        out.flush();
        out.close();
    }

    private int[] nextIntArray(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private long[] nextLongArray(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (line == null || !line.hasMoreTokens()) {
            line = new StringTokenizer(in.readLine());
        }
        return line.nextToken();
    }

    private static class Pll {
        private long key;
        private long value;

        public Pll(long key, long value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pll pll = (Pll) o;

            if (key != pll.key) return false;
            return value == pll.value;

        }

        @Override
        public int hashCode() {
            int result = (int) (key ^ (key >>> 32));
            result = 31 * result + (int) (value ^ (value >>> 32));
            return result;
        }
    }

    private static class Pii {
        private int key;
        private int value;

        public Pii(int key, int value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pii pii = (Pii) o;

            if (key != pii.key) return false;
            return value == pii.value;

        }

        @Override
        public int hashCode() {
            int result = key;
            result = 31 * result + value;
            return result;
        }

        @Override
        public String toString() {
            return "Pii{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }

    private static class Pair<K, V> {
        private K key;
        private V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
            return !(value != null ? !value.equals(pair.value) : pair.value != null);

        }

        @Override
        public int hashCode() {
            int result = key != null ? key.hashCode() : 0;
            result = 31 * result + (value != null ? value.hashCode() : 0);
            return result;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }
}


import java.io.*;
import java.util.*;

public class Solution {
    private BufferedReader in;
    private StringTokenizer line;
    private PrintWriter out;
    private boolean isDebug;

    public Solution(boolean isDebug) {
        this.isDebug = isDebug;
    }

    public void solve() throws IOException {
        int n = nextInt();
        int k = nextInt();
        k = Math.min(k, n - k);
        Tree tree = new Tree(n);
        int cr = 0;
        long res = 1;
        for (int i = 0; i < n; i++) {
            int c = 0;
            int nx = cr + k;
            if (nx <= n) {
                c += tree.sum(cr + 1, nx - 1);
            } else {
                c += tree.sum(cr + 1, n - 1);
                c += tree.sum(0, nx - n - 1);
            }
            c++;
            tree.inc(cr);
            cr = nx % n;
            tree.inc(cr);
            res += c;
            out.print(res + " ");
        }
    }

    private static class Tree {
        private int n;
        private int[] t;

        Tree(int n) {
            this.n = n;
            t = new int[n];
        }

        private int sum(int r) {
            int result = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                result += t[r];
            }
            return result;
        }

        private void inc(int i) {
            for (; i < n; i = (i | (i + 1))) {
                t[i]++;
            }
        }

        private int sum(int l, int r) {
            if (l > r) return 0;
            return sum(r) - sum(l - 1);
        }
    }

    private static final int mm = 1000000007;

    private long mult(long a, long b) {
        return a * b % mm;
    }

    private long pow(long a, int n) {
        if (n == 0) return 1;
        long t = pow(a, n / 2);
        t = mult(t, t);
        if (n % 2 != 0) t = mult(a, t);
        return t;
    }

    public static void main(String[] args) throws IOException {
        new Solution(args.length > 0 && "DEBUG_MODE".equals(args[0])).run(args);
    }

    public void run(String[] args) throws IOException {
        if (isDebug) {
            in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
//            in = new BufferedReader(new InputStreamReader(System.in));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
        }
        out = new PrintWriter(System.out);
//        out = new PrintWriter("output.txt");

//        int t = nextInt();
        int t = 1;
        for (int i = 0; i < t; i++) {
//            out.print("Case #" + (i + 1) + ": ");
            solve();
        }

        in.close();
        out.flush();
        out.close();
    }

    private int[] nextIntArray(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private long[] nextLongArray(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (line == null || !line.hasMoreTokens()) {
            line = new StringTokenizer(in.readLine());
        }
        return line.nextToken();
    }

    private static class Pll {
        private long key;
        private long value;

        public Pll(long key, long value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pll pll = (Pll) o;

            if (key != pll.key) return false;
            return value == pll.value;

        }

        @Override
        public int hashCode() {
            int result = (int) (key ^ (key >>> 32));
            result = 31 * result + (int) (value ^ (value >>> 32));
            return result;
        }
    }

    private static class Pii {
        private int key;
        private int value;

        public Pii(int key, int value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pii pii = (Pii) o;

            if (key != pii.key) return false;
            return value == pii.value;

        }

        @Override
        public int hashCode() {
            int result = key;
            result = 31 * result + value;
            return result;
        }

        @Override
        public String toString() {
            return "Pii{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }

    private static class Pair<K, V> {
        private K key;
        private V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
            return !(value != null ? !value.equals(pair.value) : pair.value != null);

        }

        @Override
        public int hashCode() {
            int result = key != null ? key.hashCode() : 0;
            result = 31 * result + (value != null ? value.hashCode() : 0);
            return result;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }
}


		import java.io.BufferedWriter;
		import java.io.IOException;
		import java.io.OutputStreamWriter;
		import java.io.ObjectInputStream.GetField;
		import java.math.BigInteger;
		import java.util.ArrayList;
		import java.util.Arrays;
		import java.util.Collections;
		import java.util.HashMap;
		import java.util.HashSet;
		import java.util.InputMismatchException;
		import java.util.LinkedList;
	import java.util.PriorityQueue;
	import java.util.Queue;
		import java.util.Stack;
		import java.util.TreeMap;
		import java.util.TreeSet;
public class Q2 {
			static int MOD = 1000000007;
			static boolean b[];
			static boolean boo[][];
			static ArrayList<Integer>[] amp, amp2;
			static HashMap<ArrayList<Integer>,Integer> ts1 = new HashMap<>();
			static int sum[][],dist[][];
			static long ans = 0;
			static int p = 0;
			static int color[][];
			static FasterScanner sc = new FasterScanner();
			static Queue<Integer> q = new LinkedList<>();
			static Queue<Pair> qu = new LinkedList<>();
			static ArrayList<Pair>[][] arr;
			static ArrayList<Graph>[] amp1;
			static ArrayList<Integer> parent = new ArrayList<>();
			static BufferedWriter log;
			static HashMap<Long,Long> hm;
			static TreeSet<Long> ts = new TreeSet<>();
			static Stack<Integer> s = new Stack<>();
			static Pair prr[];
			static char ch[][];
			static int prime[];
			static long d,x,y;
			static int n,k,m;
			public static void main(String[] args) throws IOException {
				log = new BufferedWriter(new OutputStreamWriter(System.out));
				int n = sc.nextInt(), t = sc.nextInt();
				if(n%2==1){
					int temp = n/2;
					int z = 0;
					ans = 2;
					for(int j=0;j<n-1;j+=temp){
						log.write(ans+" ");
						z++;
						for(int i = 1; i<temp;i++){
							ans+=z;
							log.write(ans+" ");
						}
						if(j!=(n-1-temp)){
							z++;
						}
						ans+=z;
						//log.write(ans+"*");
					}
					log.write(ans+" ");
				}
				else{
					int temp = n/3;
					int z = 0;
					ans = 2;
					for(int j=0;j<n-1;j+=temp){
						log.write(ans+" ");
						z++;
						for(int i = 1; i<temp;i++){
							ans+=z;
							log.write(ans+" ");
						}
						if(j!=(n-1-temp)){
							z++;
						}
						ans+=z;
						//log.write(ans+"*");
					}
					log.write(ans+" ");
				}
				log.close();
			}
			public static void dfs(int x){
				b[x] = true;
				for(int i =0 ;i<amp[x].size();i++){
					if(!b[amp[x].get(i)]){
						dfs(amp[x].get(i));
					}
				}
			}
			public static void bfs(int x){
				b[x] = true;
				q.add(x);
				while(!q.isEmpty()){
					ans++;
					int y = q.poll();
					for(int i = 0;i<amp[y].size();i++) {
						if(!b[amp[y].get(i)]){
							q.add(amp[y].get(i));
							b[amp[y].get(i)] = true;
							prime[amp[y].get(i)] = y;
						}
						else{
							if(amp[y].get(i)!=prime[y]) p++;
						}
					}
				}
			}
			public static void toThread(String[] args) throws Exception {
		    	new Thread(null, new Runnable() {
					public void run() {
						try {
							//InputReader(System.in);
					       // pw = new PrintWriter(System.out);
					        //soln();
					        //pw.close();
							//soln();
						} catch (Exception e) {
							e.printStackTrace();
						}
					}
				}, "1", 1 << 26).start();
		    }
			public static long mod(int x, int y){
				long ans = 1;
				while(y>0){
					if(y%2==1){
						ans = ((ans%MOD)*(x%MOD))%MOD;
						y-=1;
					}
					else{
						x = (int) (((x%MOD)*(x%MOD))%MOD);
						y = y/2;
					}
				}
				return ans;
			}
			public static void dfs2(int x, int y){
				boo[x][y] = true;
				ans++;
				if(ans==(p-k)){
					return;
				}
				for(Pair e:arr[x][y]){
					if(!boo[e.u][e.v]){
						dfs2(e.u,e.v);
						if(ans==(p-k)){
							return;
						}
					}
				}
			}
		/*	public static void dfs(int x){
				b[x] = true;
				for(int i =0 ;i<amp[x].size();i++){
					if(!b[amp[x].get(i)]){
						dfs(amp[x].get(i));
					}
				}

			}*/
			static void findFactors(ArrayList<Integer> primeDivisors, ArrayList<Integer> multiplicity, int currentDivisor, long currentResult) {
			    if (currentDivisor == primeDivisors.size()) {
			        ts.add(currentResult);
			        return;
			    }
			    for (int i = 0; i <= multiplicity.get(currentDivisor); ++i) {
			        findFactors(primeDivisors, multiplicity, currentDivisor + 1, currentResult);
			        currentResult *= primeDivisors.get(currentDivisor);
			    }
			}
			public static void seive(long n){
				b = new boolean[(int) (n+1)];
				Arrays.fill(b, true);
				b[0] =false;
				b[1] = true;
				for(int i = 2;i*i<=n;i++){
					if(b[i]){
						for(int p = 2*i;p<=n;p+=i){
							b[p] = false;
						}
					}
				}
				for(int i = 0;i<n;i++) if(b[i]) parent.add(i);
			}
			public static void factors(int n){
				b = new boolean[n+1];
				prime = new int[n+1];
				Arrays.fill(b, true);
				b[0] =false;
				b[1] = false;
				for(int i = 2;i*i<=n;i++){
					if(b[i]){
						prime[i] = i;
						for(int p = 2*i;p<=n;p+=i){
							if(b[p]){
							b[p] = false;
							prime[p] = i;
							}
						}
					}
				}
				for(int i = 2;i<=n;i++){
					if(b[i]) prime[i] = i;
				}
			}
			public static void buildWeightedGraph(int m){
				for(int i = 0; i<m;i++){
					int x = sc.nextInt(), y = sc.nextInt(), w = sc.nextInt();
					amp1[--x].add(new Graph(--y,w));
					amp1[y].add(new Graph(x,w));
				}
			}
			public static void extendedEuclidian(long a, long b){
				if(b == 0) {
			        d = a;
			        x = 1;
			        y = 0;
			    }
			    else {
			        extendedEuclidian(b, a%b);
			        int temp = (int) x;
			        x = y;
			        y = temp - (a/b)*y;
			    }
			}
			private static void permutation(String prefix, String str) {
			    int n = str.length();
			   // if (n == 0) ts.add(prefix);
			  //  else {
			        for (int i = 0; i < n; i++)
			            permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n));
			   //}
			}
			public static char give(char c1,char c2){
				if(c1!='a' && c2!='a') return 'a';
				if(c1!='b' && c2!='b') return 'b';
				return 'c';
			}
			static class Graph{
				int vertex;
				long weight;
				Graph(int v,int w){
					vertex = v;
					weight = w;
				}
			}
			public static void buildTree(int n){
				int arr[] = sc.nextIntArray(n);
				for(int i = 0;i<n;i++){
					int x = arr[i]-1;
					amp[i+1].add(x);
					amp[x].add(i+1);
				}
			}

			public static void buildGraph(int n){

				for(int i =0;i<n;i++){
					int x = sc.nextInt(), y = sc.nextInt();
					amp[--x].add(--y);
					amp[y].add(x);
				}
			}

			static class Pair implements Comparable<Pair> {
				int u;
				int v;
				int z;
				public Pair(){

				}
				public Pair(int u, int v) {
					this.u = u;
					this.v = v;
				}

				public int hashCode() {
					int hu = (int) (u ^ (u >>> 32));
					int hv = (int) (v ^ (v >>> 32));
					return 31*hu + hv;
				}

				public boolean equals(Object o) {
					Pair other = (Pair) o;
					return (u == other.u && v == other.v);
				}

				public int compareTo(Pair other) {
					return Integer.compare(u, other.u) != 0 ? (Integer.compare(u, other.u)) : (Integer.compare(v, other.v));
				}

				public String toString() {
					return "[u=" + u + ", v=" + v + "]";
				}
			}
			static class SegmentTree{
				long st[][];
				char ch[];
				boolean lazy[];
				SegmentTree(String str, int n){
					int size = 4*n;
					ch = str.toCharArray();
					st = new long[size][2];
					lazy = new boolean[size];
					build(ch,0,n-1,0);
				}
				long[] build(char str[], int ss, int se, int si){
					if(ss==se){
						if(str[ss]=='>') st[si][0] = 1;
						else st[si][1] = 1;
						return st[si];
					}
					int mid = (ss+se)/2;
					long temp1[] = build(str,ss,mid,si*2+1);
					long temp2[] = build(str,mid+1,se,si*2+2);
					st[si][0] = temp1[0]+temp2[0];
					st[si][1] = temp1[1]+temp2[1];
					return st[si];
				}
				void updateRange(int node, int start, int end, int l, int r, boolean val)
				{
				//	System.out.println(lazy[node]+" "+node);
				    if(lazy[node])
				    {
				        // This node needs to be updated
				    	long temp = st[node][0];
				    	st[node][0] = st[node][1];
				    	st[node][1] = temp; // Update it
				        if(start != end)
				        {
				            lazy[node*2+1] = lazy[node];                  // Mark child as lazy
				            lazy[node*2+2] = lazy[node];                // Mark child as lazy
				        }
				        lazy[node] = false;                                  // Reset it
				    }
				    if(start > end || start > r || end < l)              // Current segment is not within range [l, r]
				        return;
				    if(start >= l && end <= r)
				    {
				        // Segment is fully within range
				    	if(val){
				    	long temp = st[node][0];
				    	st[node][0] = st[node][1];
				    	st[node][1] = temp;
				        if(start != end)
				        {
				            // Not leaf node
				        	lazy[node*2+1] = val;                  // Mark child as lazy
				            lazy[node*2+2] = val;
				        }
				    	}
				        return;
				    }
				    int mid = (start + end) / 2;
				    updateRange(node*2+1, start, mid, l, r, val);        // Updating left child
				    updateRange(node*2 + 2, mid + 1, end, l, r, val);   // Updating right child
				    st[node][0] = st[node*2+1][0] + st[node*2+2][0];
				    st[node][1] = st[node*2+1][1] + st[node*2+2][1];// Updating root with max value
				}
				long[] queryRange(int node, int start, int end, int l, int r)
				{
				    if(start > end || start > r || end < l)
				        return new long[]{0,0};         // Out of range
				    if(lazy[node])
				    {
				    	long temp = st[node][0];
				    	st[node][0] = st[node][1];
				    	st[node][1] = temp; // Update it
				        if(start != end)
				        {
				            lazy[node*2+1] = lazy[node];                  // Mark child as lazy
				            lazy[node*2+2] = lazy[node];                // Mark child as lazy
				        }
				        lazy[node] = false;                  // Reset it
				    }
				    if(start >= l && end <= r)             // Current segment is totally within range [l, r]
				        return st[node];
				    int mid = (start + end) / 2;
				    long p1[] = queryRange(node*2+1, start, mid, l, r);         // Query left child
				    long p2[] = queryRange(node*2 + 2, mid + 1, end, l, r); // Query right child
				    p1[0]+=p2[0];
				    p1[1]+=p2[1];
				    return p1;
				}

				/*long get(int qs, int qe, int ss, int se, int si){
					if(qe<ss || qs>se){
						return 0;
					}
					if(qs<=ss && qe>=se) return st[si]*power(2,qe-se,3);
					int mid = (ss+se)/2;
		            return (((get(qs,qe,ss,mid,2*si+1))%3*power(2,Math.min(qe-mid, se-mid),3))%3+(get(qs,qe, mid+1, se, 2*si+2))%3)%3;
				}
				void update(char str[],int ss,int se,int si,int idx){
					if(ss==se){
						st[si] = 1;
						str[idx] = 1;
					}
					else{
						int mid = (ss+se)/2;
						if(ss<=idx && idx<=mid) update(str,ss,mid,2*si+1,idx);
						else update(str,mid+1,se,2*si+2,idx);
						st[si] = (((st[2*si+1]*power(2,se-mid,3))%3+st[2*si+2])%3)%3;
					}
				}*/
				void print(){
					for(int i = 0;i<st.length;i++){
						System.out.print(st[i][0]+" "+st[i][1]);
						System.out.println("----------------------");
					}
				}
			}
			static int convert(int x){
				int cnt = 0;
				String str = Integer.toBinaryString(x);
				//System.out.println(str);
				for(int i = 0;i<str.length();i++){
					if(str.charAt(i)=='1'){
						cnt++;
					}
				}
				int ans = (int) Math.pow(3, 6-cnt);
				return ans;
			}
			static class Node2{
				Node2 left = null;
				Node2 right = null;
				Node2 parent = null;
				int data;
			}
			static class BinarySearchTree{
				Node2 root = null;
				int height = 0;
				int max = 0;
				int cnt = 1;
				ArrayList<Integer> parent = new ArrayList<>();
				HashMap<Integer, Integer> hm = new HashMap<>();
				public void insert(int x){
					Node2 n = new Node2();
					n.data = x;
					if(root==null){
						root = n;
					}
					else{
						Node2 temp = root,temp2 = null;
						while(temp!=null){
							temp2 = temp;
							if(x>temp.data) temp = temp.right;
							else temp = temp.left;
						}
						if(x>temp2.data) temp2.right = n;
						else temp2.left = n;
						n.parent = temp2;
						parent.add(temp2.data);
					}
				}
				public Node2 getSomething(int x, int y, Node2 n){
					if(n.data==x || n.data==y) return n;
					else if(n.data>x && n.data<y) return n;
					else if(n.data<x && n.data<y) return getSomething(x,y,n.right);
					else return getSomething(x,y,n.left);
				}
				public Node2 search(int x,Node2 n){
					if(x==n.data){
						max = Math.max(max, n.data);
						return n;
					}
					if(x>n.data){
						max = Math.max(max, n.data);
						return search(x,n.right);
					}
					else{
						max = Math.max(max, n.data);
						return search(x,n.left);
					}
				}
				public int getHeight(Node2 n){
					if(n==null) return 0;
					height = 1+ Math.max(getHeight(n.left), getHeight(n.right));
					return height;
				}
			}
			static long findDiff(long[] arr, long[] brr, int m){
				int i = 0, j = 0;
				long fa = 1000000000000L;
				while(i<m && j<m){
					long x = arr[i]-brr[j];
					if(x>=0){
						if(x<fa) fa = x;
						j++;
					}
					else{
						if((-x)<fa) fa = -x;
						i++;
					}
				}
				return fa;
			}
			public static long max(long x, long y, long z){
				if(x>=y && x>=z) return x;
				if(y>=x && y>=z) return y;
				return z;
			}

			static long modInverse(long a, long mOD2){
			            return  power(a, mOD2-2, mOD2);
			}
			static long power(long x, long y, long m)
			{
			    if (y == 0)
			        return 1;
			    long p = power(x, y/2, m) % m;
			    p = (p * p) % m;

			    return (y%2 == 0)? p : (x * p) % m;
			}
			static long power2(long x,BigInteger y,long m){
				long ans = 1;
				BigInteger two = new BigInteger("2");
				while(y.compareTo(BigInteger.ZERO)>0){
					if(y.getLowestSetBit()==y.bitCount()){
						x = (x*x)%MOD;
						y = y.divide(two);
					}
					else{
						ans = (ans*x)%MOD;
						y = y.subtract(BigInteger.ONE);
					}
				}
				return ans;
			}
			static BigInteger power2(BigInteger x, BigInteger y, BigInteger m){
				BigInteger ans = new BigInteger("1");
				BigInteger one  = new BigInteger("1");
				BigInteger two  = new BigInteger("2");
				BigInteger zero  = new BigInteger("0");
				while(y.compareTo(zero)>0){
					//System.out.println(y);
					if(y.mod(two).equals(one)){
						ans = ans.multiply(x).mod(m);
						y = y.subtract(one);
					}
					else{
						x = x.multiply(x).mod(m);
						y = y.divide(two);
					}
				}
				return ans;
			}
			static BigInteger power(BigInteger x, BigInteger y, BigInteger m)
			{
			    if (y.equals(0))
			        return (new BigInteger("1"));
			    BigInteger p = power(x, y.divide(new BigInteger("2")), m).mod(m);
			    p = (p.multiply(p)).mod(m);

			    return (y.mod(new BigInteger("2")).equals(0))? p : (p.multiply(x)).mod(m);
			}

			public static long gcd(long n, long m){
				if(m!=0) return gcd(m,n%m);
				else return n;
			}

			public static class FasterScanner {
				private byte[] buf = new byte[1024];
				private int curChar;
				private int numChars;

				public int read() {
					if (numChars == -1)
						throw new InputMismatchException();
					if (curChar >= numChars) {
						curChar = 0;
						try {
							numChars = System.in.read(buf);
						} catch (IOException e) {
							throw new InputMismatchException();
						}
						if (numChars <= 0)
							return -1;
					}
					return buf[curChar++];
				}

				public String nextLine() {
					int c = read();
					while (isSpaceChar(c))
						c = read();
					StringBuilder res = new StringBuilder();
					do {
						res.appendCodePoint(c);
						c = read();
					} while (!isEndOfLine(c));
					return res.toString();
				}

				public String nextString() {
					int c = read();
					while (isSpaceChar(c))
						c = read();
					StringBuilder res = new StringBuilder();
					do {
						res.appendCodePoint(c);
						c = read();
					} while (!isSpaceChar(c));
					return res.toString();
				}

				public long nextLong() {
					int c = read();
					while (isSpaceChar(c))
						c = read();
					int sgn = 1;
					if (c == '-') {
						sgn = -1;
						c = read();
					}
					long res = 0;
					do {
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = read();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public int nextInt() {
					int c = read();
					while (isSpaceChar(c))
						c = read();
					int sgn = 1;
					if (c == '-') {
						sgn = -1;
						c = read();
					}
					int res = 0;
					do {
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = read();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

			    public int[] nextIntArray(int n) {
			        return nextIntArray(n, 0);
			    }

			    public int[] nextIntArray(int n, int off) {
			    	int[] arr = new int[n + off];
			    	for (int i = 0; i < n; i++) {
			    		arr[i + off] = nextInt();
			    	}
			    	return arr;
			    }

			    public long[] nextLongArray(int n) {
			    	return nextLongArray(n, 0);
			    }

				public long[] nextLongArray(int n, int off) {
				    long[] arr = new long[n + off];
				    for (int i = 0; i < n; i++) {
				        arr[i + off] = nextLong();
				    }
				    return arr;
				}

			    private boolean isSpaceChar(int c) {
					return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				}

				private boolean isEndOfLine(int c) {
					return c == '\n' || c == '\r' || c == -1;
				}
			}
		}