{"problem":{"name":"At Most 3 (Judge ver.)","description":{"content":"There are $N$ weights called Weight $1$, Weight $2$, $\\dots$, Weight $N$. Weight $i$ has a mass of $A_i$.   Let us say a positive integer $n$ is a **good integer** if the following condition is satisf","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc251_b"},"statements":[{"statement_type":"Markdown","content":"There are $N$ weights called Weight $1$, Weight $2$, $\\dots$, Weight $N$. Weight $i$ has a mass of $A_i$.  \nLet us say a positive integer $n$ is a **good integer** if the following condition is satisfied:\n\n*   We can choose **at most $3$** different weights so that they have a total mass of $n$.\n\nHow many positive integers less than or equal to $W$ are good integers?\n\n## Constraints\n\n*   $1 \\leq N \\leq 300$\n*   $1 \\leq W \\leq 10^6$\n*   $1 \\leq A_i \\leq 10^6$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $W$\n$A_1$ $A_2$ $\\dots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc251_b","tags":[],"sample_group":[["2 10\n1 3","3\n\nIf we choose only Weight $1$, it has a total mass of $1$, so $1$ is a good integer.  \nIf we choose only Weight $2$, it has a total mass of $3$, so $3$ is a good integer.  \nIf we choose Weights $1$ and $2$, they have a total mass of $4$, so $4$ is a good integer.  \nNo other integer is a good integer. Also, all of $1$, $3$, and $4$ are integers less than or equal to $W$. Therefore, the answer is $3$."],["2 1\n2 3","0\n\nThere are no good integers less than or equal to $W$."],["4 12\n3 3 3 3","3\n\nThere are $3$ good integers: $3, 6$, and $9$.  \nFor example, if we choose Weights $1$, $2$, and $3$, they have a total mass of $9$, so $9$ is a good integer.  \nNote that $12$ is **not** a good integer."],["7 251\n202 20 5 1 4 2 100","48"]],"created_at":"2026-03-03 11:01:14"}}