#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define REP(i, n) for(int(i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int(i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int(i) = (n); (i) < (m); ++(i))

// clang-format off
template<class T> inline bool chmax(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
// clang-format on
constexpr int INF = 1e9;

class Timer {
  chrono::time_point<chrono::system_clock> start;

public:
  Timer() { start = chrono::system_clock::now(); }
  double duration() {
    return chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
    // return chrono::duration<chrono::milliseconds>(chrono::system_clock::now()- start).count();
  }
};
class xorShift {
  uint32_t x, y, z, w;
  static const double TO_DOUBLE;

public:
  xorShift() {
    x = 123456789;
    y = 362436069;
    z = 521288629;
    w = 88675123;
  }
  xorShift(uint32_t seed) {
    x = seed = 1812433253u * (seed ^ (seed >> 30));
    y = seed = 1812433253u * (seed ^ (seed >> 30)) + 1;
    z = seed = 1812433253u * (seed ^ (seed >> 30)) + 2;
    w = seed = 1812433253u * (seed ^ (seed >> 30)) + 3;
  }
  uint32_t nextInt(uint32_t n) {
    uint32_t t = x ^ (x << 11);
    x = y;
    y = z;
    z = w;
    w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    return w % n;
  }
  uint32_t nextInt() {
    uint32_t t = x ^ (x << 11);
    x = y;
    y = z;
    z = w;
    return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
  }
  double nextDouble() { return nextInt() * TO_DOUBLE; }
};
const double xorShift::TO_DOUBLE = 1.0 / (1LL << 32);

Timer T;
xorShift rnd;
constexpr double TIME_LIMIT = 1800;
constexpr int N = 20;
int M;
vector<string> s;
vector<string> using_s;

bool internal_string(const string& word, const vector<string> strings) {
  int n = word.size();
  REP(i, (int)strings.size()) {
    int m = strings[i].size();
    for(int j = 0; j + n <= m; j++) {
      if(word == strings[i].substr(j)) {
        return true;
      }
    }
  }
  return false;
}
void select_using_s(const vector<string>& origin, vector<string>& out) {
  int n = origin.size();
  out.push_back(origin[0]);
  FOR(i, 1, n) {
    if(!internal_string(origin[i], out)) {
      out.push_back(origin[i]);
    }
  }
}
struct Solver {
  vector<string> ans, best_ans;
  int best_score;
  Solver() : ans(N), best_ans(N), best_score(0) {}
  void first_method() {
    string all_string;
    REP(i, (int)using_s.size()) { all_string += using_s[i]; }
    REP(i, N) {
      string line;
      REP(j, N) {
        if(i * N + j < (int)all_string.size()) {
          line += all_string[i * N + j];
        }
        else {
          line += ".";
        }
      }
      best_ans[i] = line;
    }
  }
  // void random_select() {
  //   vector<int> st;
  //   REP(i, (int)using_s.size()) { st.push_back(i); }
  //   string all_string;
  //   REP(i, (int)using_s.size()) {
  //     int id = rnd.nextInt((int)st.size());
  //     all_string += st[id];
  //     st.erase(st.begin() + id);
  //   }
  //   REP(i, N) {
  //     REP(j, N) {
  //       int id = i * N + j;
  //       if(id <
  //     }
  //   }
  // }
  void print_best_ans() {
    REP(i, N) { cout << best_ans[i] << endl; }
  }
};

int main() {
  int n;
  cin >> n >> M;
  s.resize(M);
  REP(i, M) { cin >> s[i]; }
  Solver solver;
  sort(s.begin(), s.end(), [](const string& l, const string& r) -> bool {
    if(l.size() == r.size()) {
      return l < r;
    }
    return l.size() > r.size();
  });
  select_using_s(s, using_s);
  solver.first_method();
  solver.print_best_ans();
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define endl            "\n"
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void __print(int32_t x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
char myHeap[200 * 1024 * 1024];
int sz = 0;
void assert_tle(bool q) { while (!q); }
void* operator new  ( std::size_t count ) {
    sz += count;
    assert_tle(sz <= 200 * 1024 * 1024);
    return myHeap + sz - count;
}
 
void operator delete (void *ptr) { }
 

int power(int a,int b)
{
    int ans=1;

    while(b)
    {
        if(inf/ans<5) return 5;
        if(b&1) ans*=a;

        if(inf/a<a) return 5;
        a*=a;
        b>>=1;
    }

    return ans;

}
 
void fastIO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int dfs(int cur,vector<int> v[],int used[],int ar[])
{
    if(used[cur]) return 0;

    used[cur]=1;

    int ret=ar[cur];

    for(int kid: v[cur])
    {
        ret+=dfs(kid,v,used,ar);
    }

    return ret;
}

void solve()
{
    int n,m;
    cin>>n>>m;

    if(n!=1&&(m<0||m>=n-1))
    {
        cout<<-1;
        return;
    }

    int req=m+1;

    //if(m<)
    int start= 1e6;
    int i=0;
    for(;i<req;i++)
    {
        cout<<start<<" "<<start+1<<endl;
        start+=2;
    }

    for(int l=1;i<n;i++,l++)
    {
        cout<<l<<" "<<100000000-l<<endl;
    }
}
 
int32_t main()
{
    fastIO();
    //w(t)
    {
        solve();
        cout<<endl;
    }
    return 0;
}