output_description: Print the number of ways for the children to share candies, modulo 10^9 + 7.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      a_1 a_2 \ldots a_N
attempt: def main():
      M = 10**9 + 7
      n, k, *a = map(int, open(0).read().split())
      dp = [[1] + [0] * k]
      for b, i in zip(dp, a):
          t, d = 0, []
          for v in b[: i + 1]:
              t += v
              t %= M
              d += (t,)
          for w, v in zip(b, b[i + 1 :]):
              t += v - w
              t %= M
              d += (t,)
          dp += (d,)
      print(t)
  
  
  main()
  
problem_description: Statement
  
  There are N children, numbered 1, 2, \ldots, N.
  
  They have decided to share K candies among themselves. Here, for each i (1
  \leq i \leq N), Child i must receive between 0 and a_i candies (inclusive).
  Also, no candies should be left over.
  
  Find the number of ways for them to share candies, modulo 10^9 + 7. Here, two
  ways are said to be different when there exists a child who receives a
  different number of candies.
samples: [{"input": "3 4\n    1 2 3", "output": "5\n    \n\nThere are five ways for the children to share candies, as follows:\n\n  * (0, 1, 3)\n  * (0, 2, 2)\n  * (1, 0, 3)\n  * (1, 1, 2)\n  * (1, 2, 1)\n\nHere, in each sequence, the i-th element represents the number of candies that\nChild i receives.\n\n* * *"}, {"input": "1 10\n    9", "output": "0\n    \n\nThere may be no ways for the children to share candies.\n\n* * *"}, {"input": "2 0\n    0 0", "output": "1\n    \n\nThere is one way for the children to share candies, as follows:\n\n  * (0, 0)\n\n* * *"}, {"input": "4 100000\n    100000 100000 100000 100000", "output": "665683269\n    \n\nBe sure to print the answer modulo 10^9 + 7."}]