Bus
The company bus follows a specific route, picking up workers at various stops and taking them to the factory, provided there are available seats. The bus can wait at a stop for workers who haven't arrived yet. You are given the arrival time of each worker at their stop and the travel time for the bus between consecutive stops. The bus starts its journey at the first stop at time zero, and the time taken for workers to board the bus is negligible.
Your task is to write a program that calculates the minimum time needed for the bus to transport the maximum number of workers possible.
Input Data
The first line contains two integers: the number of stops N and the number of seats on the bus M. Each of the following N lines provides information for each stop: the travel time from stop i to stop i + 1 (with the N + 1-th stop being the factory), the number of workers K arriving at stop i, and the arrival times of these workers in the order they arrive. The constraints are 1 ≤ M ≤ 2000 and 1 ≤ N, K ≤ 200000.
Output Data
Output the minimum time required for the bus to transport the maximum number of workers.