N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) x = [0] * 101 for i, b in enumerate(B): x[b] += A[i] print('YES' if max(x[1:]) <= x[0] else 'NO')