import Data.List.Split
main=mapM_(print.solve).chunksOf 2.map(map read.words).lines=<<getContents 
solve::[[Int]]->Int
solve[[n],as]=f 0 where
  f k=if e==k then k else f e where
    e=sum$map(\a->(a+k-n)`div`(n+1)+1)as