#include <bits/stdc++.h>
using namespace std;
vector<int> a, b;
int n, m, k, x;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < (int)(k); ++i) {
    cin >> x;
    a.push_back(x);
  }
  cin >> x;
  for (int i = 0; i < (int)(n * m - k); ++i) {
    cin >> x;
    b.push_back(x);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= m; j++) {
      auto p = lower_bound(a.begin(), a.end(), i + j);
      auto q = lower_bound(b.begin(), b.end(), i + m + 1 - j);
      if (p != a.end())
        a.erase(p);
      else if (q != b.end())
        b.erase(q);
      else
        return cout << "NO", 0;
    }
  cout << "YES\n";
}
