Problem: Convexity of a set of points on the plane is the size of the largest subset of points that form a convex polygon. Your task is to build a set of n points with the convexity of exactly m. Your set of points should not contain three points that lie on a straight line.

Input

The single line contains two integers n and m (3 ≤ m ≤ 100, m ≤ n ≤ 2m).

Output

If there is no solution, print "-1". Otherwise, print n pairs of integers — the coordinates of points of any set with the convexity of m. The coordinates shouldn't exceed 108 in their absolute value.

Examples

Input

4 3


Output

0 0
3 0
0 3
1 1


Input

6 3


Output

-1


Input

6 6


Output

10 0
-10 0
10 1
9 1
9 -1
0 -2


Input

7 4


Output

176166 6377
709276 539564
654734 174109
910147 434207
790497 366519
606663 21061
859328 886001

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

import javax.sound.sampled.LineEvent;

import static java.lang.Math.*;

public class B implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;
	
	public static void main(String[] args) {
		new Thread(null, new B(), "", 64*1024*1024).start();
	}

	public void run() {
		try {
			long t1 = 0, t2 = 0, m1 = 0, m2 = 0;
			if (LOCAL) {
				t1 = System.currentTimeMillis();
				m1 = Runtime.getRuntime().freeMemory();
			}
			Locale.setDefault(Locale.US);
			if (LOCAL) {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			} else {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			}
			tok = new StringTokenizer("");
			solve();
			in.close();
			out.close();
			if (LOCAL) {
				t2 = System.currentTimeMillis();
				m2 = Runtime.getRuntime().freeMemory();
				System.err.println("Time = " + (t2 - t1) + " ms.");
				System.err.println("Memory = " + ((m1 - m2) / 1024) + " KB.");
			}
		} catch (Throwable e) {
			e.printStackTrace(System.err);
			throw new RuntimeException();
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) return null;
			tok = new StringTokenizer(line);
		}
		return tok.nextToken();
	}
	
	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}
	
	long readLong() throws IOException {
		return Long.parseLong(readString());
	}
	
	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}
	
	static class Mergesort {

		private Mergesort() {}

		public static void sort(int[] a) {
			mergesort(a, 0, a.length - 1);
		}

		public static void sort(long[] a) {
			mergesort(a, 0, a.length - 1);
		}

		public static void sort(double[] a) {
			mergesort(a, 0, a.length - 1);
		}

		private static final int MAGIC_VALUE = 42;

		private static void mergesort(int[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void mergesort(long[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void mergesort(double[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergesort(a, leftIndex, middleIndex);
					mergesort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void merge(long[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			long[] leftArray = new long[length1];
			long[] rightArray = new long[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void merge(double[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			double[] leftArray = new double[length1];
			double[] rightArray = new double[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

		private static void insertionSort(long[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				long current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

		private static void insertionSort(double[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				double current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

	}
	
	void debug(Object... o) {
		if (LOCAL) {
			System.err.println(Arrays.deepToString(o));
		}
	}
	
	final static boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null;
	
//------------------------------------------------------------------------------

	long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	
	class Line implements Comparable<Line> {
		long a, b, c;

		public Line(long px, long py, long qx, long qy) {
			a = qy - py;
			b = px - qx;
			c = -px*a - py*b;
			norm();
		}
		
		void norm() {
			long g = gcd(gcd(a,b),c);
			a /= g;
			b /= g;
			c /= g;
			if (a < 0 || a == 0 && b < 0) {
				a = -a;
				b = -b;
				c = -c;
			}
		}
		
		@Override
		public int compareTo(Line o) {
			if (a == o.a) {
				if (b == o.b) {
					return Long.compare(c, o.c);
				}
				return Long.compare(b, o.b);
			}
			return Long.compare(a, o.a);
		}
		
		@Override
		public String toString() {
			return "Line [a=" + a + ", b=" + b + ", c=" + c + "]";
		}
	}
	
	void solve() throws IOException {
		int n = readInt();
		int m = readInt();
		if (m == 3) {
			String[] ans = new String[] {
					"0 0",
					"3 0",
					"0 3",
					"1 1"
			};
			if (n <= 4) {
				for (int i = 0; i < n; i++) {
					out.println(ans[i]);
				}
			} else {
				out.println(-1);
			}
			return;
		}
		double[] bx = new double[m];
		double[] by = new double[m];
		double R = 1e7;
		double angle = 2 * PI / m;
		bx[0] = R;
		by[0] = 0;
		for (int i = 1; i < m; i++) {
			bx[i] = bx[i-1] * cos(angle) - by[i-1] * sin(angle);
			by[i] = bx[i-1] * sin(angle) + by[i-1] * cos(angle);
		}
		long[] x = new long[2*m];
		long[] y = new long[2*m];
		for (int i = 0; i < m; i++) {
			x[i] = round(bx[i]);
			y[i] = round(by[i]);
		}
		long S = 0;
		for (int i = 0; i < m; i++) {
			int j = (i + 1) % m;
			S += x[i] * y[j] - x[j] * y[i];
		}
		debug(x);
		debug(y);
		S = abs(S);
		debug(m);
		TreeSet<Line> lines = new TreeSet<Line>();
		for (int i = 0; i < m; i++) {
			for (int j = i+1; j < m; j++) {
				if (!lines.add(new Line(x[i], y[i], x[j], y[j]))) {
					throw new RuntimeException(i + " " + j);
				}
			}
		}
		/*for (Line line : lines) {
			debug(line);
		}*/
		if (lines.size() != m*(m-1)/2) {
			throw new RuntimeException("bad set size = " + lines.size() + " instead of " + m*(m-1)/2);
		}

		for (int i = 0; i < m; i++) {
			boolean found = false;
			o:
			for (int dx = -20; dx <= 20; dx++) {
				for (int dy = -20; dy <= 20; dy++) {
					if (dx != 0 || dy != 0) {
						long px = x[i] + dx;
						long py = y[i] + dy;
						if (inside(x, y, m, px, py, S)) {
							if (inSector(x[(i+1)%m], y[(i+1)%m], x[i], y[i], 0, 0, px, py)) {
								if (checkLines(x, y, m+i, px, py, lines)) {
									found = true;
									x[i + m] = px;
									y[i + m] = py;
									break o;
								} else {
									//debug("fail check line, iteration = " + i + " dx = " + dx + " dy = " + dy);
								}
							}
						}
					}
				}
			}
			if (!found) {
				throw new RuntimeException("iteration " + i + " is bad");
			}
		}
		for (int i = 0; i < n; i++) {
			out.println(x[i] + " " + y[i]);
		}
	}

	private boolean inSector(long ax, long ay, long ox, long oy, long bx, long by, long px, long py) {
		ax -= ox; ay -= oy;
		bx -= ox; by -= oy;
		px -= ox; py -= oy;
		long wpAB = ax*by - ay*bx;
		long wpAP = ax*py - ay*px;
		long wpPB = px*by - py*bx;
		if (wpAB == 0 || wpAP == 0 || wpPB == 0) {
			return false;
		}
		int signAB = wpAB > 0 ? 1 : -1;
		int signAP = wpAP > 0 ? 1 : -1;
		int signPB = wpPB > 0 ? 1 : -1;
		return signAB == 1 && signAP == 1 && signPB == 1;
	}

	private boolean checkLines(long[] x, long[] y, int points, long px, long py, TreeSet<Line> lines) {
		Line[] curLines = new Line[points];
		for (int i = 0; i < points; i++) {
			curLines[i] = new Line(x[i], y[i], px, py);
			if (lines.contains(curLines[i])) {
				return false;
			}
		}
		for (Line line : curLines) {
			lines.add(line);
		}
		return true;
	}

	private boolean inside(long[] x, long[] y, int m, long px, long py, long S) {
		long curS = 0;
		for (int i = 0; i < m; i++) {
			int j = (i + 1) % m;
			long trS = abs(
					x[i] * y[j] - x[j] * y[i] +
					x[j] * py - px * y[j] +
					px * y[i] - x[i] * py
			);
			if (trS == 0) {
				return false;
			}
			curS += trS;
		}
		return curS == S;
	}
	
}