#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int N = a + b + 1;
  string s[N];
  for (int k = 0; k < N; k++) {
    cin >> s[k];
  }
  if (s[a] == "-") {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
