s=0 a=int(input()) for _ in range(int(input())): s += int(input()) for i in range(100): if (s+i)%a == 0: k+=1 print(k)