#include <stdio.h>

main(argc, argv)
int	argc;
char	*argv[];
{
register FILE	*fp;
register int	i, n, max;
char		line[100];

if (argc != 3) {
	fprintf(stderr, "Usage: %s file max\n", argv[0]);
	exit(1);
	}
if ((fp = fopen(argv[1], "r")) == (FILE *)NULL) {
	perror(argv[1]);
	exit(2);
	}
max = atoi(argv[2]);
i = 0;
while (fgets(line, sizeof line, fp) != (char *)NULL) {
	n = atoi(line);
	if (n-- > i) {
		if (i == n)
			printf("%u\n", i);
		else
			printf("%u-%u\n", i, n);
		}
	i = n + 2;
	}
fclose(fp);
if (max >= i) {
	if (i == max)
		printf("%u\n", i);
	else
		printf("%u-%u\n", i, max);
	}
exit(0);
}
