for _ in [0] * int(input()): n = int(input()) print(n - sum(map(int, input().split())))