Pondo Sums
Problem Statement
You are given some positive integers, you are told how many of each different integer you have. You are also given an integer , determine the different integers under or equal to that you can make by summing up some subset of these integers (pick some and leave the others).
Input Format
Your first line will contain two space-separated integers and , where is the number of unique integers you have (and is the same as in the problem statement). Your next lines will contain two integers each and , meaning that you have many of the number .
Output Format
Output a single line, containing all the numbers under or equal to that can be formed by summing some of the integers together.
Constraints
Sample Cases
Input 1
1 100
20 1
Output 1
20
Input 2
2 60
20 3
5 1
Output 2
5 20 25 40 45 60
Comments