using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _617 { class Program { static void Main(string[] args) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); bool[] dp = new bool[5000000]; dp[0] = true; for (int i = 0; i < x[0]; i++) { int a = int.Parse(Console.ReadLine()); for (int j = 4999999; j >= 0; j--) { if (dp[j]) dp[j + a] = true; } } int ret = 0; for (int i = 0; i <= x[1]; i++) if (dp[i]) ret = i; Console.WriteLine(ret); } } }