// Opravena Stankova verzia (Palo)
//

#include <stdio.h>

FILE *fin, *fout;

int vag[1010];
int nvag;
int rest;
int n;

int main(void)
{
	int nova = 0;
	int first = 1;
	int k, i, j, ok, x;

	fin = stdin;
	fout = stdout;
	do {
		fscanf(fin,"%d", &x);
		if (x == 0) { // new input
			nova = 1;
			k = 0;
			fscanf(fin,"%d", &n);
			if (n == 0) break;
		}
		else {
			if (first) { // first time
				first = 0;
				n = x;
				k = 0;
			}
			else 
				k = x;
		}

		// simulation
		nvag = 0;
		rest = 1;
		ok = 1;
		for (i=0; i<n; i++) {
			if (k==0 || i!=0) { // already read
				fscanf(fin,"%d",&k);
				x = 1;
			}
			if (!ok) continue;
			if (rest <= k) {
				for (j=rest; j<=k; j++) 
					vag[nvag++] = j;
				rest = k+1;
				nvag--;
			}
			else {
				if (nvag == 0) {
					ok = 0;
					continue;
				}
				if (vag[nvag-1] == k) {
					nvag--;
				}
				else {
					ok = 0;
					continue;
				}
			}
		}
		
		if (nova) {
			nova = 0;
			fprintf(fout,"\n");
		}
		fprintf(fout,"%s\n", ok ? "Yes" : "No");
	} while (1);
	fprintf (fout, "\n");		// Palo - zaverecny prazdny riadok

	fclose(fin);
	fclose(fout);
	return 0;
}
