import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); try { int[] total = new int[100]; int player = 0; int N = Integer.parseInt(read.readLine()); String[] box = read.readLine().split(" "); int[] point = new int[N]; for (int i = 0; i < N; ++i) { point[i] = Integer.parseInt(box[i]); } box = read.readLine().split(" "); for (int i = 0; i < N; ++i) { int index = Integer.parseInt(box[i]); if (index == 0) { player += point[i]; } else { total[index - 1] = point[i]; } } int max = -1; for (int i = 0; i < 100; ++i) { if (total[i] > max) { max = total[i]; } } if (max <= player) { System.out.println("YES"); } else { System.out.println("NO"); } } catch (Exception e) { e.printStackTrace(); } } }