X = int(input())
N = int(input())
W = list(map(int,input().split()))
Q = int(input())
used = set()
c = X
for i in range (Q):
P = int(input())
t = W[P-1]
if P in used:
c -= t
used.remove(P)
else:
c+=t
used.add(P)
print(c)