import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto S = readln.chomp;
    auto T = readln.chomp;

    if (S.canFind('*')) {
        if (N > M + 1) {
            writeln("NO");
            return;
        }
        bool ok = true;
        for (int i = 0; S[i] != '*'; ++i) {
            if (S[i] != T[i]) {
                ok = false;
                break;
            }
        }
        for (int i = 0; S[N-i-1] != '*'; ++i) {
            if (S[N-i-1] != T[M-i-1]) {
                ok = false;
                break;
            }
        }
        writeln(ok ? "YES" : "NO");
    } else {
        writeln( S == T ? "YES" : "NO" );
    }

}
