t = int(input()) for i in range(t): n = int(input()) s = list(map(int, input().split())) print((n - sum(s) + 1) % (n + 1))