First, let’s force Vasya to change tire on everyday with negative temperature (even on consecutive days) so she will change tire for 2⋅cnt time where cnt is the number of days with negative temperature. If cnt>k obviously the answer is -1, otherwise the winter tire can still last for some extra days. Now let’s see if we can use the winter tire on days with non-negative temperature. We can sort all the length of the consecutive days with non-negative temperature, so we can greedily use winter tires on those segments. For each segment we use, we save tire change twice. Finally let’s see if we can use the winter tire until the last day after the last negative-temperature day.