import math from heapq import heappush, heappop def solve(): import sys N, L = map(int, sys.stdin.readline().split()) W = list(map(int, sys.stdin.readline().split())) # Step 1: Compute the GCD of all coin values d_all = W[0] for w in W[1:]: d_all = math.gcd(d_all, w) # Function to handle the case when GCD is 1 def compute_new_case(new_W, new_L): a = min(new_W) if a == 1: return new_L # Compute dist array using modified Dijkstra's algorithm dist = [float('inf')] * a heap = [] # Initialize with each coin's value for w in new_W: rem = w % a if w < dist[rem]: dist[rem] = w heappush(heap, (w, rem)) # Process the heap while heap: k, r = heappop(heap) if k > dist[r]: continue # Skip outdated entries for w in new_W: new_k = k + w new_r = (r + w) % a if new_k < dist[new_r]: dist[new_r] = new_k heappush(heap, (new_k, new_r)) # Calculate the answer ans = 0 for r in range(a): dr = dist[r] if dr == float('inf') or dr > new_L: continue max_m = (new_L - dr) // a ans += max_m + 1 return ans # Check if GCD is greater than 1 if d_all > 1: if L < d_all: print(0) return new_L = L // d_all new_W = [w // d_all for w in W] print(compute_new_case(new_W, new_L)) else: print(compute_new_case(W, L)) if __name__ == '__main__': solve()