#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   long long powmod(long long a, long long b) {     long long res = 1;     a %= mod;     assert(b >= 0);     for (; b; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   const int maxx = 10005;   const int INF = 0x3f3f3f3f;   int n, m, k;   int vis[maxx];   int ans = 0, cnt = 0, pos = 0;   int l = 0, r = 0;   string a, b;   string s1, s2;   int main() {     scanf( %d%d , &n, &m);     cin >> a >> b;     if (n > m + 1) {       printf( NO n );       return 0;     }     int fk = 0;     int tag = 0;     for (int i = 0; i < n; i++) {       if (a[i] ==  * ) {         tag = 1;         continue;       }       if (tag == 0)         s1.push_back(a[i]);       else         s2.push_back(a[i]);     }     if (tag) {       fk = 0;       for (int i = 0; i < ((int)(s1).size()); i++) {         if (b[i] != s1[i]) fk = 1;       }       for (int i = ((int)(s2).size()) - 1; i >= 0; i--) {         if (b[m - ((int)(s2).size()) + i] != s2[i]) {           fk = 1;         }       }     } else {       if (n != m)         fk = 1;       else {         for (int i = 0; i < n; i++) {           if (a[i] != b[i]) {             fk = 1;             break;           }         }       }     }     if (a ==  * ) fk = 0;     if (fk)       printf( NO n );     else       printf( YES n );     return 0;   }   