integer::N,M,i,j,k,c integer,allocatable,dimension(:,:)::a integer,allocatable,dimension(:)::b read *,N,M allocate(a(M,N),b(N)) do i=1,M read *,a(i,:) end do b=0 do i=1,M do j=1,N if(j==1) then do k=1,N b(k)=b(k)+a(i,k) end do end if c=sum(b(1:j)) do k=1,N-j+1 if(c==777) then print *,'YES' stop end if c=c-b(k)+b(k+j) end do end do end do print *,'NO' end