Building a Scholarship Table

Count CGPA range tables with equal widths and arithmetic rates that spend exactly P units on the given students.

Medium7Brute forceMathPrefix sumNo attempts yetTime limit4sMemory limit256 MB

Problem

A university gives scholarships based on each student's CGPA. At the start of a semester it posts a table of scholarship rates by CGPA range. Here are two such tables.

CGPA rangeScholarship rate
4.00-4.0050%
3.90-3.9940%
3.80-3.8930%
3.70-3.7920%
3.60-3.6910%
CGPA rangeScholarship rate
3.91-4.0080%
3.71-3.9050%
3.51-3.7020%

The first table says that a student whose CGPA is between 3.60 and 3.69 receives 10% of the tuition fee as a scholarship. In the same way a student whose CGPA is between 3.90 and 3.99 receives 40%. The rules for such a table are:

  1. Every student inside one CGPA range receives the same rate.
  2. All ranges must have the same width. Only the highest range may be narrower. The ranges begin at the bottom end of the lowest range, continue with that same width, and stop at the range that contains 4.00. The top of the last range is cut off at 4.00.
  3. The rate of the lowest range is a positive integer. Each step up adds a fixed positive integer to the rate. That step is 10% in the first table and 30% in the second one.
  4. Every rate is a positive integer and can never exceed 100%.
  5. The money that gives one student a 1% scholarship is one unit. Giving 50% to two students costs 50×2=10050 \times 2 = 100 units.
  6. The whole budget of PP units must be spent, with nothing left over.
  7. A scholarship range cannot start below 2.50. So 2.50-2.55 is allowed and 2.45-2.55 is not.
  8. There must be at least two ranges. A range that holds no student is allowed.

CGPA values and range boundaries are multiples of 0.01 between 0.00 and 4.00.

You are given the number of students, the number of units to spend, and the CGPA of every student. Count the different scholarship tables that spend exactly PP units. Two tables are different if their CGPA ranges differ, or if any range carries a different rate.

Input

The input holds at most 100 test sets.

The first line of each set has the number of students NN (1N100001 \le N \le 10000) and the number of units to spend PP (1P10000001 \le P \le 1000000), separated by a space. Each of the next NN lines has the CGPA of one student, written with two digits after the decimal point. A CGPA is between 0.00 and 4.00.

The last line of the input holds two zeros and is not processed. Every set admits at least one table that spends exactly PP units.

Output

For each test set print one line with DD, the number of different scholarship tables that spend all PP units.

Hint

In the first example, take 2.88-3.02 as the lowest range and continue with that width up to 4.00. That gives eight ranges. A lowest rate of 10% with a step of 10% produces the table below.

CGPA rangeStudentsScholarship rateUnits needed
3.93-4.00280%160
3.78-3.92070%0
3.63-3.77360%180
3.48-3.62050%0
3.33-3.47040%0
3.18-3.32230%60
3.03-3.17020%0
2.88-3.02110%10

The total is 410 units. Another 79553 tables spend those 410 units exactly.