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