N = int(input()) D = list(map(int, input().split())) x = max(map(int, input().split())) if x in D: print(1) else: d = max(D) print(max(2, (x + d - 1)//d))