program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,m,i,c,d

    read*, n,m
    c=0
    d=1
    do i=1,m
        print'(2(i0,1x))', c+1,d+1
        c=modulo(c-1,n)
        d=d+1
    end do
    
end program name