#include <bits/stdc++.h>
using namespace std;
double x[1005], y[1005], theta, R, sx, sy, ang;
int n, m, tri;
int main() {
  scanf("%d%d", &n, &m);
  if ((n == 6 && m == 3) || (n == 5 && m == 3))
    printf("-1\n");
  else {
    x[0] = 0;
    y[0] = 10000000;
    theta = 2.0 * 3.141592653 / m;
    for (int i = (1); i < (m); i++) {
      x[i] = x[i - 1] * cos(theta) - y[i - 1] * sin(theta);
      y[i] = x[i - 1] * sin(theta) + y[i - 1] * cos(theta);
    }
    sx = 0;
    sy = 100000;
    ang = 2.0 * 3.141592653 / (m + 1);
    x[m] = sx * cos(ang) - sy * sin(ang);
    y[m] = sx * sin(ang) + sy * cos(ang);
    for (int i = (m + 1); i < (2 * m); i++) {
      x[i] = x[i - 1] * cos(theta) - y[i - 1] * sin(theta);
      y[i] = x[i - 1] * sin(theta) + y[i - 1] * cos(theta);
    }
    for (int i = (0); i < (n); i++) printf("%d %d\n", (int)x[i], (int)y[i]);
  }
  return 0;
}
