import java.util.Scanner; public class Fac{ public static void main(String[] arg){ Scanner sc = new Scanner(System.in); int n,res=0,win=0; n = sc.nextInt(); int[] score = new int[n]; int[] flag = new int[n]; int[] others = new int[100]; for(int i = 0;i<n;i++){ score[i] = sc.nextInt(); } for(int i = 0;i<n;i++){ flag[i] = sc.nextInt(); } for(int i = 0;i<100;i++){ others[i] = 0; } for(int i = 0;i<n;i++){ if(flag[i] == 0){ res = res + score[i]; }else{ others[flag[i]-1] = others[flag[i]-1]+score[i]; } } for(int i = 0;i<100;i++){ if(res < others[i]){ win = 1; break; } } if(win == 1){ System.out.println("NO"); }else{ System.out.println("YES"); } } }