#54377: 串燒python語言


fangbruce (Bruce)


N, M = map(int, input().split())
beef = list(map(int, input().split()))

send = {}
for x in beef:
    send[x] = send.get(x, 0) + 1

order = {}
for i in range(M):
    d = list(map(int, input().split()))
    for x in d[1:]:
        order[x] = order.get(x, 0) + 1

less = 0
more = 0

items = set(send) | set(order)

for x in items:
    s = send.get(x, 0)
    o = order.get(x, 0)
    if s < o:
        less += o - s
    elif s > o:
        more += s - o

print(less, more)