#include <bits/stdc++.h>
using namespace std;
long double R = 1e7;
long double pi = 3.1415;
long double pr = 0.000001;
long double ep = pr;
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  if (m == 3 && (n == 6 || n == 5)) {
    printf("-1\n");
    return 0;
  }
  while (n > 0) {
    for (int i = 0; i < min(n, m); i++) {
      printf("%d %d\n", (int)(R * cos((i * 2 * pi + pr) / m)),
             (int)(R * sin((i * 2 * pi + pr) / m)));
    }
    n -= m;
    R -= 1000;
    pr += ep;
  }
  return 0;
}
