#include using namespace std; int main() { int N, K; cin >> N >> K; if( K < N/2 || ( N == 1 && K == 0 ) ) { cout << -1 << endl; }else { cout << N+(N-K) << endl; for( int i = 1; i <= N-K; i++ ) cout << 2*i-1 << ' ' << 2*i << endl; for( int i = 1; i <= N; i++ ) cout << i << ' ' << i << endl; } }