#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    char rem[a+1];
    char ram[b+1];
    scanf("%s%s",rem,ram);
    int yes=1;
    if (ram[0]!='-')yes=0;
    if (yes==1)
    {
        for (int i=0;i<a;i++)
        {
            if (rem[i]<'0'||rem[i]>'9')
            {
                yes=0;
                break;
            }
        }
        if (yes==0)break;
        for (int i=1;i<b;i++)
        {
            if (ram[i]<'0'||rem[i]>'9')
            {
                yes=0;
                break;
            }
        }
    }
    if (yes==0)printf ("No\n");
    else printf ("Yes\n");
}