Nerdy Bernie takes notes diligently at the university lectures and adds page numbers to his pages, starting at 1, incrementing by 1. However, on his way home, stormy winds tear his notes out of his hands, scattering the pages around him. While he is gathering his notes, the rain begins to fall, soaking some of the pages. Of course, when Bernie arrives home, he immediately starts to lay them out to dry, but the pages with page numbers blurred by the rain are no longer usable or recoverable.
Your job is to help Bernie determine those continuously numbered ranges of pages that were soaked wet in the rainstorm.
The first line of the input contains two integers N and M, separated by exactly one space. N represents the number of numbered pages Bernie had before leaving the university for home (0 < N < 231), and M represents the number of pages with page numbers still readable (0 ≤ M ≤ 1000 and M ≤ N).
The next line consists of exactly M different integers ai (0 < ai ≤ N, where 1 ≤ i ≤ M), representing the page numbers of the pages with page numbers still readable. Consecutive numbers are separated by a space.
The program should output the continuously numbered ranges of pages that were soaked wet, by
printing the first and the last page number of each range, with a hyphen (
Output for Sample Input
|University of Debrecen; Faculty of Informatics; v. 03/01/2019|