#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = acos(-1.0);
const ll LINF = (ll)1e18 + 5;
const int INF = (int)1e9 + 5;

template<class T>
T sqr(T x) { return x * x; }

template<class T>
T abs(T x) { return x < 0 ? -x : x; }

template<class T>
ll round(T x) { return x < 0 ? x - 0.5 : x + 0.5; }

template<class T>
bool chmin(T & x, const T & y) {
	if (y < x) {
		x = y;
		return true;
	}
	return false;
}

template<class T>
bool chmax(T & x, const T & y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}


template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
	bool was = false;
	os << "{";
	for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

template<class T>
ostream & operator <<(ostream & os, const set<T> & v) {
	bool was = false;
	os << "{";
	for (typename set<T>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

template<class T>
ostream & operator <<(ostream & os, const multiset<T> & v) {
	bool was = false;
	os << "{";
	for (typename multiset<T>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const map<P, Q> & v) {
	bool was = false;
	os << "{";
	for (typename map<P, Q>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

#define all(x) (x).begin(), (x).end()

template<class T>
T nextInt() {
	ll x = 0;
	bool p = false;
	char c;
	do {
		c = getchar();
	} while (c <= 32);
	if (c == '-') {
		p = true;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return (p ? -x : x);
}

set<int> tmp;
bool myCmp(vector<int> a, vector<int> b) {
	if (a.size() > b.size()) swap(a, b);
	for (int i = 0; i < (int)a.size(); i++) {
		if (b[i] != a[i]) return false;
	}
	for (int i = 0; i < (int)a.size(); i++) {
		tmp.erase(a[i]);
	}
	bool ok = true;
	static vector<int> erased;
	erased.resize(0);
	for (int i = (int)a.size(); i < (int)b.size(); i++) {
		int cur = *tmp.begin(); tmp.erase(tmp.begin());
		erased.push_back(cur);
		ok = ok && (cur == b[i]);
	}
	for (int i = 0; i < (int)a.size(); i++) {
		tmp.insert(a[i]);
	}
	for (int x : erased) {
		tmp.insert(x);
	}
	return ok;
}

int main() {
	srand(time(0));

#ifdef LOCAL
	//gen();
	freopen("input.txt", "r", stdin);
#else
	
#endif

	int n, m, q;

	scanf("%d%d", &n, &m);
	scanf("%d", &q);

	vector<int> a(q);

	for (int & x : a) {
		scanf("%d", &x);
	}

	reverse(all(a));

	map<int, set<int>> listOfHeight;
	vector<vector<int>> cols(n);

	for (int i = 0; i < n; i++) {
		listOfHeight[cols[i].size()].insert(i);
	}

	map<int, set<int>> whoNeed;
	set<int> was;

	for (int x : a) {
		auto & z = whoNeed[x];
		if (!z.empty()) {
			int idx = *z.begin(); z.erase(z.begin());
			listOfHeight[cols[idx].size()].erase(idx);
			cols[idx].push_back(x);
			listOfHeight[cols[idx].size()].insert(idx);
			was.insert(x);
			while ((--listOfHeight.end())->second.empty()) {
				listOfHeight.erase(--listOfHeight.end());
			}
			int h = (--listOfHeight.end())->first;
			auto & t = listOfHeight[h];
			int hiIdx = *t.begin();
			if ((int)cols[idx].size() < h) {
				whoNeed[cols[hiIdx][cols[idx].size()]].insert(idx);
			}
		}
		else {
			if (was.count(x)) continue;
			was.insert(x);
			while ((--listOfHeight.end())->second.empty()) {
				listOfHeight.erase(--listOfHeight.end());
			}
			int h = (--listOfHeight.end())->first;
			auto & t = listOfHeight[h];
			int idx = *t.begin(); t.erase(t.begin());
			cols[idx].push_back(x);
			listOfHeight[cols[idx].size()].insert(idx);
			for (int q : t) {
				whoNeed[x].insert(q);
			}
		}
	}


	for (int i = 1; i <= m; i++) {
		tmp.insert(i);
	}

	bool res = true;
	for (int i = 0; i + 1 < (int)cols.size(); i++) {
		res = res && myCmp(cols[i], cols[i + 1]);
	}

	puts(res ? "Yes" : "No");
}


Measured memory_bytes: 41720