#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, i;
  cin >> a >> b;
  char s1[a];
  char s2[1];
  char s3[b];
  for (i = 0; i < a; i++) cin >> s1[i];
  cin >> s2[0];
  for (i = 0; i < b; i++) cin >> s3[i];
  bool flag = true;
  for (i = 0; i < a; i++)
    if (s1[i] < 48 && 57 < s1[i]) flag = false;
  if (s2[0] != 45) flag = false;
  for (i = 0; i < b; i++)
    if (s3[i] < 48 && 57 < s3[i]) flag = false;
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
