n,m = map(int,input().split())
coins = sorted(list(map(int,input().split())),reverse=True)

dp = [float("inf")]*50001

dp[0] = 0

for  i in range(50001):
    for coin in coins:
        if i+coin > 50000:
            continue
        
        else:
            dp[i+coin] = min(dp[i+coin], dp[i]+1)

print(dp[n]) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m coins = sorted(list(map(int,input().split())),reverse=True) coins sorted(list(map(int,input().split())),reverse=True) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split reverse=True reverse True dp = [float("inf")]*50001 dp [float("inf")]*50001 [float("inf")] float("inf") float "inf" 50001 dp[0] = 0 dp[0] dp 0 0 for  i in range(50001):
    for coin in coins:
        if i+coin > 50000:
            continue
        
        else:
            dp[i+coin] = min(dp[i+coin], dp[i]+1) i range(50001) range 50001 for coin in coins:
        if i+coin > 50000:
            continue
        
        else:
            dp[i+coin] = min(dp[i+coin], dp[i]+1) coin coins if i+coin > 50000:
            continue
        
        else:
            dp[i+coin] = min(dp[i+coin], dp[i]+1) i+coin > 50000 i+coin i coin 50000 continue dp[i+coin] = min(dp[i+coin], dp[i]+1) dp[i+coin] dp i+coin i coin min(dp[i+coin], dp[i]+1) min dp[i+coin] dp i+coin i coin dp[i]+1 dp[i] dp i 1 print(dp[n]) print dp[n] dp n dp = [float("inf")]*50001 [float("inf")]*50001 dp n,m = map(int,input().split()) map(int,input().split()) n m = map(int,input().split()) map(int,input().split()) m coins = sorted(list(map(int,input().split())),reverse=True) sorted(list(map(int,input().split())),reverse=True) coins
n,m = map(int,input().split())
coins = sorted(list(map(int,input().split())),reverse=True)

dp = [float("inf")]*50001

dp[0] = 0

for  i in range(50001):
    for coin in coins:
        if i+coin > 50000:
            continue
        
        else:
            dp[i+coin] = min(dp[i+coin], dp[i]+1)

print(dp[n])
