The first line of input contains N and K. The next N lines contain N distinct integers in the range 1…109, indicating how many years ago each of Bessie's N ancestors lived.
Print the minimum number of years it will take Bessie to visit all her ancestors and return to the present year.
One way for Bessie to visit all her ancestors and return in 36 years is as follows:
Enter the portal in the present day and travel 48 years into the past.
Wait 12 years, then enter the portal 36 years in the past and travel 108 years into the past.
Wait 24 years, then enter the portal 84 years in the past and travel back to the present year.
Problem credits: Brian Dean and David YangProblem credits: Brian Dean and David Yang