Slavko can show at most K advertising banners on his web page each day.
Advertisers do not require an exact calendar date for the first time their banner appears. Instead, after a banner first appears, they specify the relative days on which that same banner must appear again. The first display day is counted as day 1. For each request, the span from the first required display to the last required display is at most 7 days.
Slavko receives the requests in order. If request A arrives before request B, then the first display of B cannot be earlier than the first display of A.
Slavko wants to minimize the number of days from the day the first banner starts appearing until the day the last banner appears.
Write a program that finds this minimum number of days.
The first line contains two integers N and K: the number of requests and the maximum number of banners that can be shown on one day. 1 <= N <= 100 and 1 <= K <= 4.
Each of the next N lines describes one request, in the order Slavko received them. The first integer R_i is the total number of times that banner must be displayed. It is followed by R_i - 1 integers. These integers are the additional relative days, counting the first display day as day 1, on which the banner must also be displayed. The days are given in increasing order.
Output one integer: the minimum number of days from the first banner display to the last banner display.