inf = 2**31
n,m = map(int,raw_input().split())
coins = map(int,raw_input().split())
dp = [inf]*(n+1)
dp[n] = 0
while dp[0] == inf:
    for coin in coins:
        for i in range(n,coin-1,-1):
            if dp[i] < inf:
                dp[i-coin] = min(dp[i-coin],dp[i]+1)
print dp[0] inf = 2**31 inf 2**31 2 31 n,m = map(int,raw_input().split()) n map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split m coins = map(int,raw_input().split()) coins map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split dp = [inf]*(n+1) dp [inf]*(n+1) [inf] inf n+1 n 1 dp[n] = 0 dp[n] dp n 0 while dp[0] == inf:
    for coin in coins:
        for i in range(n,coin-1,-1):
            if dp[i] < inf:
                dp[i-coin] = min(dp[i-coin],dp[i]+1) dp[0] == inf dp[0] dp 0 inf for coin in coins:
        for i in range(n,coin-1,-1):
            if dp[i] < inf:
                dp[i-coin] = min(dp[i-coin],dp[i]+1) coin coins for i in range(n,coin-1,-1):
            if dp[i] < inf:
                dp[i-coin] = min(dp[i-coin],dp[i]+1) i range(n,coin-1,-1) range n coin-1 coin 1 -1 if dp[i] < inf:
                dp[i-coin] = min(dp[i-coin],dp[i]+1) dp[i] < inf dp[i] dp i inf 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[0] dp 0 n,m = map(int,raw_input().split()) map(int,raw_input().split()) n inf = 2**31 2**31 inf m = map(int,raw_input().split()) map(int,raw_input().split()) m coins = map(int,raw_input().split()) map(int,raw_input().split()) coins dp = [inf]*(n+1) [inf]*(n+1) dp
inf = 2**31
n,m = map(int,raw_input().split())
coins = map(int,raw_input().split())
dp = [inf]*(n+1)
dp[n] = 0
while dp[0] == inf:
    for coin in coins:
        for i in range(n,coin-1,-1):
            if dp[i] < inf:
                dp[i-coin] = min(dp[i-coin],dp[i]+1)
print dp[0]