import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int [] now = new int [N+1]; for(int i=1; i<=N; i++){ now[i]=i; } int K = sc.nextInt(); for(int i=0; i list = new ArrayList(); while(true){ int count=0; for(int i=1; i<=N; i++){ if(now[i]fin[i]){ while(now[i]!=fin[i]){ String s = (now[i]-1)+" "+now[i]; list.add(s); for(int j=1; j<=N; j++){ if(now[i]-1==now[j]){ now[i]--; now[j]++; break; } } } }else{ count++; } } if(count==N){break;} } int l=list.size(); System.out.println(l); for(int i=0; i