#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
const double PI=acos(-1);
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
    if(x>y)return x;
    else return y;
}
ll min(ll x,ll y){
    if(x<y)return x;
    else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
    
    int n,m;cin >> n >> m;
    if(n==1 && m==0){
        cout << "1 2" << endl;return 0;
    }
    if(m==n || m<0 || m+1==n){
        cout << -1 << endl;
        return 0;
    }
    if(m==0){
        rep(i,n)cout << 3*i+1 << ' ' << 3*i+2 << endl;
        return 0;
    }

    int l=m+1;
    int k=n-l-1;
    rep(i,k){
        cout << 3*i+1+1 << ' ' << 3*i+1+1+1 << endl;
    }
    rep(i,l){
        cout << 3*k+3*i+1+1 << ' ' << 3*k+3*i+1+1+1 << endl;
    }
    cout << 3*k+1 << ' ' << 100000000 << endl;
}
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(vec) vec.begin(), vec.end()
#define allr(vec) vec.rbegin(), vec.rend()
#define CST(x) cout << fixed << setprecision(x)
using namespace std;

void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}

using ll = long long;

const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;

template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vi = vector<int>;
using vll = vector<ll>;

//------

void _main() {
  int a, b; cin >> a >> b;

  if (a + b >= 15 && b >= 8) {
    cout << 1 << endl;
  } else if (a + b >= 10 && b >= 3) {
    cout << 2 << endl;
  } else if (a + b >= 3) {
    cout << 3 << endl;
  } else {
    cout << 4 << endl;
  }
}
