#include <bits/stdc++.h>
using namespace std;

long long p[303030];
const long long mod = 1e9 + 7;
long long base;

struct node {
	node *l = nullptr;
	node *r = nullptr;
	node *p = nullptr;
	int size = 1;

	long long val;
	long long hash;

	node(long long val) : val(val), hash(val) {}
};

unsigned long long xor_shift() {
	static unsigned long long x = time(NULL);
	x ^= x << 13; x ^= x >> 7; x ^= x << 17;
	return x;
}

int size(node *x) {
	return x ? x->size : 0;
}

long long hash_v(node *x) {
	return x ? x->hash : 0;
}

node *update(node *x) {
	x->size = 1 + size(x->l) + size(x->r);
	x->hash = (hash_v(x->l) * base + x->val) % mod;
	x->hash = (x->hash * p[size(x->r)] + hash_v(x->r)) % mod;
	return x;
}

node *merge(node *x, node *y) {
	if (!x) return y;
	if (!y) return x;
	if (xor_shift() % (size(x) + size(y)) < size(x)) {
		x->r = merge(x->r, y);
		if (x->r) x->r->p = x;
		return update(x);
	} else {
		y->l = merge(x, y->l);
		if (y->l) y->l->p = y;
		return update(y);
	}
}

pair<node *, node *> split(node *x, bool erase_x = false) {
	if (!x) return make_pair(nullptr, nullptr);
	node *l = x->l;
	node *r = x->r;
	x->l = nullptr;
	x->r = nullptr;
	x = update(x);

	while (x->p) {
		bool dir = x->p->l == x;
		x = x->p;
		if (dir) {
			x->l = r;
			if (r) r->p = x;
			r = update(x);
		} else {
			x->r = l;
			if (l) l->p = x;
			l = update(x);
		}
	}
	if (l) l->p = nullptr;
	if (r) r->p = nullptr;
	return make_pair(l, r);
}

pair<node *, node *> split(node *x, int k) {
	if (x == nullptr) return make_pair(nullptr, nullptr);
	if (k <= size(x->l)) {
		auto p = split(x->l, k);
		x->l = p.second;
		if (p.first != nullptr) p.first->p = nullptr;
		if (p.second != nullptr) p.second->p = x;
		return make_pair(p.first, update(x));
	} else {
		auto p = split(x->r, k - size(x->l) - 1);
		x->r = p.first;
		if (p.first != nullptr) p.first->p = x;
		if (p.second != nullptr) p.second->p = nullptr;
		return make_pair(update(x), p.second);
	}
}

int main() {
	int n, m, q;
	cin >> n >> m >> q;

	srand(time(NULL));
	base = rand() + 100;

	p[0] = 1;
	for (int i = 1; i < 303030; i++) {
		p[i] = p[i - 1] * base % mod;
	}

	vector<int> a(q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &a[i]);
		a[i]--;
	}
	reverse(a.begin(), a.end());

	vector<int> val(m);
	vector<int> hor(n), ver(m);
	vector<int> pos(m, -1);

	int k = 0;
	for (int i = 0; i < q; i++) {
		if (pos[a[i]] == -1) {
			val[k] = a[i];
			pos[a[i]] = k;
			k++;
			hor[0]++;
			ver[a[i]]++;
		} else {
			if (hor[ver[a[i]]] == pos[a[i]]) {
				hor[ver[a[i]]]++;
				ver[a[i]]++;
			}
		}
	}

	vector<node *> tr(m);
	for (int i = 0; i < m; i++) {
		tr[i] = new node(i + 100);
	}

	node *t = nullptr;
	for (int i = 0; i < m; i++) {
		t = merge(t, tr[i]);
	}

	vector<long long> hh(n);

	k = 0;
	for (int i = n - 1; i >= 0; i--) {
		while (k < hor[i]) {
			auto qr = split(tr[val[k]]);
			auto pq = split(qr.first, k);

			tr[val[k]]->p = nullptr;
			tr[val[k]]->l = nullptr;
			tr[val[k]]->r = nullptr;
			update(tr[val[k]]);

			t = merge(pq.first, tr[val[k]]);
			t = merge(t, pq.second);
			t = merge(t, qr.second);
			k++;
		}

		hh[i] = hash_v(t);
	}

	bool ok = true;
	for (int i = 0; i < n; i++) {
		if (hh[i] != hh[0]) ok = false;
	}
	puts(ok ? "Yes" : "No");
}

Measured memory_bytes: 12416