output_description: Print the maximum possible number of happy children.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N x
      a_1 a_2 ... a_N
attempt: n, x = map(int, input().split())
  
  a = list(map(int, input().split()))
  
  
  def score(a, m, x):
      ans = x * (n + m)
      l = n // m
      for i in range(n):
          t = (n - 1 - i) // m
          if i < m:
              ans += ((t + 2) ** 2) * a[i]
          else:
              ans += ((t + 2) ** 2) * (a[i] - a[i - m])
      for i in range(m):
          ans += a[n - 1 - i]
      return ans
  
  
  def search(left, right, l_score, r_score, a, x):
      tri = (right - left) // 3
      u_score = score(a, left + tri, x)
      v_score = score(a, left + tri * 2, x)
      if right - left <= 3:
          return min(u_score, v_score, l_score, r_score)
      elif l_score < u_score:
          return search(left, left + tri, l_score, u_score, a, x)
      elif r_score < v_score:
          return search(left + tri * 2, right, v_score, r_score, a, x)
      elif u_score < v_score:
          return search(left, left + tri * 2, l_score, v_score, a, x)
      else:
          return search(left + tri, right, u_score, r_score, a, x)
  
  
  def sub_search(r, a, x):
      ans = score(a, r // 2 + 1, x)
      # print(ans)
      for i in range(r // 2):
          j = r // 2 - i
          ddd = score(a, j, x)
          # print(ddd)
          if ddd <= ans:
              ans = ddd
          else:
              break
      return ans
  
  
  # k = search(1, n, score(a, 1, x), score(a, n, x), a, x)
  k = sub_search(n, a, x)
  print(k)
  
problem_description: Statement
  
  There are N children, numbered 1, 2, ..., N.
  
  Snuke has decided to distribute x sweets among them. He needs to give out all
  the x sweets, but some of the children may get zero sweets.
  
  For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly
  a_i sweets. Snuke is trying to maximize the number of happy children by
  optimally distributing the sweets. Find the maximum possible number of happy
  children.
samples: [{"input": "3 70\n    20 30 10", "output": "2\n    \n\nOne optimal way to distribute sweets is (20, 30, 20).\n\n* * *"}, {"input": "3 10\n    20 30 10", "output": "1\n    \n\nThe optimal way to distribute sweets is (0, 0, 10).\n\n* * *"}, {"input": "4 1111\n    1 10 100 1000", "output": "4\n    \n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\n* * *"}, {"input": "2 10\n    20 20", "output": "0\n    \n\nNo children will be happy, no matter how the sweets are distributed."}]