#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string a, b;
  cin >> a >> b;
  if (m < n - 1) {
    cout << "NO" << endl;
    return 0;
  } else {
    int al = 0, ar = n - 1, bl = 0, br = m - 1;
    while ((a[al] == b[bl]) && (al < n) && (a[al] != '*')) {
      al++;
      bl++;
    }
    if (a[al] != '*') {
      if (a[al] != b[bl]) {
        cout << "NO" << endl;
        return 0;
      } else if (al == n) {
        cout << "YES" << endl;
        return 0;
      }
    }
    while ((a[ar] == b[br]) && (ar > al) && (a[ar] != '*')) {
      ar--;
      br--;
    }
    if ((a[ar] != '*') && (a[ar] != b[br])) {
      cout << "NO" << endl;
      return 0;
    }
    cout << "YES" << endl;
  }
  return 0;
}
