N, M = map(int, input().split())
C = [0] + list(map(int, input().split()))
C.sort()

dp = [[0] * (N+1) for _ in range(M+1)]
for i in range(N+1):
	dp[1][i] = i
for i in range(2,M+1):
	for j in range(1, N+1):
		if C[i] > j:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = min(dp[i-1][j], dp[i][j-C[i]]+1)

print(dp[M][N]) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M C = [0] + list(map(int, input().split())) C [0] + list(map(int, input().split())) [0] 0 list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split C.sort() C.sort C sort [0] * (N+1) for _ in range(M+1) for _ in range(M+1) _ range(M+1) range M+1 M 1 for _ in range(M+1) [0] * (N+1) [0] 0 N+1 N 1 dp = [[0] * (N+1) for _ in range(M+1)] dp [[0] * (N+1) for _ in range(M+1)] for i in range(N+1):
	dp[1][i] = i i range(N+1) range N+1 N 1 dp[1][i] = i dp[1][i] [1] dp 1 i i for i in range(2,M+1):
	for j in range(1, N+1):
		if C[i] > j:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = min(dp[i-1][j], dp[i][j-C[i]]+1) i range(2,M+1) range 2 M+1 M 1 for j in range(1, N+1):
		if C[i] > j:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = min(dp[i-1][j], dp[i][j-C[i]]+1) j range(1, N+1) range 1 N+1 N 1 if C[i] > j:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = min(dp[i-1][j], dp[i][j-C[i]]+1) C[i] > j C[i] C i j dp[i][j] = dp[i-1][j] dp[i][j] [i] dp i j dp[i-1][j] [i-1] dp i-1 i 1 j dp[i][j] = min(dp[i-1][j], dp[i][j-C[i]]+1) dp[i][j] [i] dp i j min(dp[i-1][j], dp[i][j-C[i]]+1) min dp[i-1][j] [i-1] dp i-1 i 1 j dp[i][j-C[i]]+1 dp[i][j-C[i]] [i] dp i j-C[i] j C[i] C i 1 print(dp[M][N]) print dp[M][N] [M] dp M N C = [0] + list(map(int, input().split())) [0] + list(map(int, input().split())) C M = map(int, input().split()) map(int, input().split()) M N, M = map(int, input().split()) map(int, input().split()) N dp = [[0] * (N+1) for _ in range(M+1)] [[0] * (N+1) for _ in range(M+1)] dp
N, M = map(int, input().split())
C = [0] + list(map(int, input().split()))
C.sort()

dp = [[0] * (N+1) for _ in range(M+1)]
for i in range(N+1):
	dp[1][i] = i
for i in range(2,M+1):
	for j in range(1, N+1):
		if C[i] > j:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = min(dp[i-1][j], dp[i][j-C[i]]+1)

print(dp[M][N])
