Linear Inequation

AtCoder
IDabc436_g
Time2000ms
Memory256MB
Difficulty
You are given a length-$N$ sequence of positive integers $A=(A _ 1,A _ 2,\ldots,A _ N)$ and a positive integer $M$. Find the number of length-$N$ sequences of non-negative integers $x=(x _ 1,x _ 2,\ldots,x _ N)$ that satisfy the following condition: * $\displaystyle\sum _ {i=1} ^ NA _ ix _ i\le M$ The number can be very large, so find it modulo $998244353$. ## Constraints * $1\le N\le100$ * $1\le A _ i\le100\ (1\le i\le N)$ * $1\le M\le10 ^ {18}$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $M$ $A _ 1$ $A _ 2$ $\ldots$ $A _ N$ [samples]
Samples
Input #1
4 6
5 4 3 2
Output #1
10

The sequences $x$ that satisfy the condition are the following $10$: $(0,0,0,0),(0,0,0,1),(0,0,0,2),(0,0,0,3),(0,0,1,0),(0,0,1,1),(0,0,2,0),(0,1,0,0),(0,1,0,1),(1,0,0,0)$.
Thus, print `10`.
Input #2
6 89
4 7 5 10 7 6
Output #2
38469
Input #3
1 1000000007
1
Output #3
1755655

There are $1000000008$ sequences $x$ that satisfy the condition.
Print this modulo $998244353$, which is $1755655$.
Input #4
20 738894495848985641
40 58 13 24 65 11 63 29 98 75 40 77 15 50 83 85 35 46 38 37
Output #4
31156940
API Response (JSON)
{
  "problem": {
    "name": "Linear Inequation",
    "description": {
      "content": "You are given a length-$N$ sequence of positive integers $A=(A _ 1,A _ 2,\\ldots,A _ N)$ and a positive integer $M$. Find the number of length-$N$ sequences of non-negative integers $x=(x _ 1,x _ 2,\\ld",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc436_g"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a length-$N$ sequence of positive integers $A=(A _ 1,A _ 2,\\ldots,A _ N)$ and a positive integer $M$.\nFind the number of length-$N$ sequences of non-negative integers $x=(x _ 1,x _ 2,\\ld...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments