from heapq import heappop, heappush

def get_p(f, total):
    a = f * 100 // total
    b = f * 100 % total
    if 2 * b >= total:
        a += 1
    return a

def main():
    T = int(input())  # the number of test cases

    for case in range(1, T+1):
        total_people, num_languages = map(int, input().split())
        freq = map(int, input().split())

        low_scores = []
        not_responded = total_people
        res = 0

        for f in freq:
            key = f * 100 % total_people * 2
            if 0 < key < total_people:
                heappush(low_scores, (-key, f))
            else:
                res += get_p(f, total_people)
            not_responded -= f

        while not_responded:
            try:
                diff, f = heappop(low_scores)
            except IndexError:
                f = 0

            f += 1
            key = f * 100 % total_people * 2

            if 0 < key < total_people:
                heappush(low_scores, (-key, f))
            else:
                res += get_p(f, total_people)
            not_responded -= 1

        res += sum(get_p(x[1], total_people) for x in low_scores)

        print('Case #{}: {}'.format(case, res))

main()