| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 25 | 19 | 18 | 78.261% |
You are an enthusiastic worker. You want to know how many days you can work during the next specified number of days.
Saturdays and Sundays are non-working days. In addition, a number of national holidays and some company-specific days are non-working days. You cannot work on non-working days. Such non-working days may overlap: The founding anniversary of the company may coincide with a national holiday. Even when such non-working days coincide, there is no system to grant additional non-working days.
Today is Monday. Your task is to count the number of days you can work within a specified period starting from today.
The input consists of at most $100$ test cases. Each test case is given in the following format.
$n$ $m$
$a_1$ $\cdots$ $a_n$
The first line contains the number of additional non-working days $n$, and the number of days of the specified period $m$ ($1 ≤ n ≤ 300$, $1 ≤ m ≤ 10^{18}$). The second line contains $n$ integers, $a_1, \dots , a_n$ ($1 ≤ a_i ≤ 10^{18}$). With today being the first day, the $a_i$-th day for $i = 1, \dots , n$ is a non-working day. The list $a_1, \dots , a_n$ may contain duplicates.
The end of the input is indicated by a line consisting of two zeros.
For each test case, output in a line the number of days you can work during $m$ days starting from today.
4 8 1 2 3 4 2 10 15 3 3 14 6 7 13 5 1000000000000000000 8 15 1 8 999999999999999994 2 3 1 4 0 0
2 7 10 714285714285714282 2
ICPC > Regionals > Asia Pacific > Japan > Japan Domestic Contest > 2025 Japan Domestic Contest C번