import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); boolean[] sums = new boolean[k + 1]; sums[0] = true; for (int i = 0; i < n; i++) { int x = sc.nextInt(); for (int j = k - x; j >= 0; j--) { if (sums[j]) { sums[j + x] = true; } } } for (int i = k; i >= 0; i--) { if (sums[i]) { System.out.println(i); return; } } } }