from collections import defaultdict def main(): E = defaultdict(int) n, q = list(map(int, input().split())) A = list(map(int, input().split())) ans = 0 def f(a, b, c): d = 0 if E[(a, b)] == 4: d -= 1 E[(a, b)] += c if E[(a, b)] == 4: d += 1 return d def f0(a, b): rep = 0 rep += f(a, 0, b) rep += f(a, 1, b) if not a % 5: rep += f(a//5, 0, b) if not a % 7: rep += f(a//7, 0, b) if not a % 11: rep += f(a//11, 0, b) rep += f(a//11, 1, b) if not a % 19: rep += f(a//19, 1, b) if not a % 29: rep += f(a//29, 1, b) return rep for a in A: ans += f0(a, 1) for _ in range(q): t, x = list(map(int, input().split())) if t == 1: ans += f0(x, 1) else: ans += f0(x, -1) print(ans) main()