program Guess_The_Number
    implicit none
    integer(4):: n, m
    integer(4):: i,j,k
    integer(4), allocatable:: number(:), s(:), c(:)

    read*, n, m
    allocate(number(n), s(m), c(m))

    do i=1, m
        read*, s(i), c(i)
    end do

    number(:) = 0

    do i=1, m
        if(number(s(i)) /= 0 .and. number(s(i)) /= c(i)) call die()
        if(s(i) == 1 .and. c(i) == 0) call die()
        number(s(i)) = c(i)
    end do

    if (number(1) == 0) number(1) = 1


    block
        character(1):: c_num(n)

        do i=1, n
            write(c_num(i), '(i0)') number(i)
        end do

        print*, c_num(:)
    end block

contains
subroutine die()
    print*, -1
    stop
end subroutine
end program Guess_The_Number