#include <bits/stdc++.h>
using namespace std;
int main(){
	int n=2000,t=1000;
	scanf("%d%d",&n,&t);
	printf("%d %d\n",n+t,n-1+t*2);
	for(int i=1; i<n; ++i)
		printf("%d %d\n",i,i+1);
	for(int i=1; i<=t; ++i){
		const int p=rand()%n+1;
		printf("%d %d\n",i+n,p);
		printf("%d %d\n",i+n,p);
	}
	return 0;
}