#include<iostream>
using namespace std;
int main()
{
	int  a,b;
	cin>>b>>a;
	int c=a+b;
	if(c>=15&&a>=8)
	cout<<1;
	else if(c>=10&&a>=3)
	cout<<2;
	else if (c>=3)
	cout<<3;
	else
	cout<<4;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  int n, m;
  cin >> n >> m;

  if (n == 1) {
    cout << ((m == 0) ? "1 2\n" : "-1") << endl;
    return 0;
  }
  if (m < 0 || m > n - 2) {
    cout << -1 << endl;
    return 0;
  }

  ll p = 2;
  rep(i, m + 1) {
    printf("%ld %ld\n", p, p + 1);
    p += 2;
  }
  printf("1 %ld\n", p);
  p++;
  rep(i, n - m - 2) {
    printf("%ld %ld\n", p, p + 1);
    p += 2;
  }
}
