local ffi = require 'ffi' print((function (f, g, n, s, t) local a=f(n,s) return g(a,t) and "YES" or "NO" end)(function (n, s) local a,i=ffi.new("int8_t[?]",n),0 for e in s:gmatch("%d+") do a[i]=tonumber(e) i=i+1 end return a end, function (a, s) local h,i={["0"]=0},0 for e in s:gmatch("%d+") do if h[e]==nil then h[e]=0 end h[e],i=h[e]+a[i],i+1 end for k,v in pairs(h) do if v>h["0"] then return false end end return true end, tonumber(io.stdin:read("*l")), io.stdin:read("*l"), io.stdin:read("*l")))