import sys
import math
from collections import defaultdict, deque
from copy import deepcopy
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    n, m = MI()
    mlist = LI()
    d = [[float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1)]
    for i, value in enumerate(mlist):
        for j in range(n+1):
            if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
    print(d[m][n])

        
    
if __name__ == "__main__":
    main() import sys sys import math math from collections import defaultdict, deque from copy import deepcopy input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def RD(): return input().rstrip() RD def F(): return float(input().rstrip()) F def I(): return int(input().rstrip()) I def MI(): return map(int, input().split()) MI def MF(): return map(float,input().split()) MF def LI(): return list(map(int, input().split())) LI def LF(): return list(map(float,input().split())) LF [num for i in range(W)] for j in range(H) for j in range(H) j range(H) range H for j in range(H) [num for i in range(W)] def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
     Init H H W W num num def main():
    n, m = MI()
    mlist = LI()
    d = [[float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1)]
    for i, value in enumerate(mlist):
        for j in range(n+1):
            if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
    print(d[m][n])

        
     main n, m = MI() n MI() MI m mlist = LI() mlist LI() LI [float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1) for j in range(m+1) j range(m+1) range m+1 m 1 for j in range(m+1) [float('inf') if i != 0 else 0 for i in range(n+1)] d = [[float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1)] d [[float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1)] for i, value in enumerate(mlist):
        for j in range(n+1):
            if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
     i value enumerate(mlist) enumerate mlist for j in range(n+1):
            if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
     j range(n+1) range n+1 n 1 if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
     j < value j value d[i+1][j] = d[i][j] d[i+1][j] [i+1] d i+1 i 1 j d[i][j] [i] d i j d[i+1][j] = min(d[i][j], d[i+1][j-value]+1) d[i+1][j] [i+1] d i+1 i 1 j min(d[i][j], d[i+1][j-value]+1) min d[i][j] [i] d i j d[i+1][j-value]+1 d[i+1][j-value] [i+1] d i+1 i 1 j-value j value 1 print(d[m][n]) print d[m][n] [m] d m n if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
     def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
     Init input = sys.stdin.readline sys.stdin.readline input def MF(): return map(float,input().split()) def MF(): return map(float,input().split()) MF def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def LF(): return list(map(float,input().split())) def LF(): return list(map(float,input().split())) LF def I(): return int(input().rstrip()) def I(): return int(input().rstrip()) I def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI def F(): return float(input().rstrip()) def F(): return float(input().rstrip()) F def main():
    n, m = MI()
    mlist = LI()
    d = [[float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1)]
    for i, value in enumerate(mlist):
        for j in range(n+1):
            if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
    print(d[m][n])

        
     def main():
    n, m = MI()
    mlist = LI()
    d = [[float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1)]
    for i, value in enumerate(mlist):
        for j in range(n+1):
            if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
    print(d[m][n])

        
     main def RD(): return input().rstrip() def RD(): return input().rstrip() RD
import sys
import math
from collections import defaultdict, deque
from copy import deepcopy
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    n, m = MI()
    mlist = LI()
    d = [[float('inf') if i != 0 else 0 for i in range(n+1)] for j in range(m+1)]
    for i, value in enumerate(mlist):
        for j in range(n+1):
            if j < value:
                d[i+1][j] = d[i][j]
            else:
                d[i+1][j] = min(d[i][j], d[i+1][j-value]+1)
    print(d[m][n])

        
    
if __name__ == "__main__":
    main()
