program EDPCE
    implicit none
    integer(8)::N,W,i,j,inf,vmax,dp(1000000,100),ans
    integer(8),allocatable,dimension(:)::wi,vi
    read*,N,W
    allocate(wi(N))
    allocate(vi(N))
    read(5,*)(wi(i),vi(i),i=1,N)

    inf=W+1000
    vmax=N*maxval(vi)
    ans=0

    do i=1,N
        do j=1,vmax
            if(i==1)then
                if(j<=vi(i))then
                    dp(j,i)=wi(i)
                    if(dp(j,i)<=W)ans=max(ans,j)
                else
                    dp(j,i)=inf
                end if
            else
                if(j<=vi(i))dp(j,i)=min(dp(j,i-1),Wi(i))
                if(j>vi(i))dp(j,i)=min(dp(j,i-1),dp(j-vi(i),i-1)+wi(i))
                if(dp(j,i)<=W)ans=max(ans,j)
            end if
        end do
    end do

    print'(i0)',ans
end program EDPCE