This is a math question.
The original list is from 1 to N.
Then remove elements that are multiple cn_i from the list.
N = int(input())
list1 = []
for i in range(1, N+1, 1):
list1.append(i)
M = int(input())
for i in range(M):
cn = int(input())
list2 = []
for j in range(len(list1)):
if (j+1)%cn != 0:
list2.append(list1[j])
list1 = list2
for x in list1:
print(x)