#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, i, j, l1, l2, l3, cs = 0, cp = -1, f = 0;
  cin >> n >> m;
  string s, t;
  cin >> s;
  cin >> t;
  l1 = s.length();
  l2 = t.length();
  for (i = 0; i < l1; ++i) {
    if (s[i] == '*') {
      cs = 1;
      cp = i;
    }
  }
  if (cs == 0) {
    if (s != t)
      cout << "NO";
    else
      cout << "YES";
    return 0;
  } else {
    l3 = l1 - 1;
    if (l3 > l2)
      cout << "NO";
    else {
      j = 0;
      for (i = 0; i < cp; i++, j++) {
        if (s[i] != t[j]) {
          f = 1;
          break;
        }
      }
      if (f == 1) {
        cout << "NO";
        return 0;
      }
      j = m - 1;
      for (i = n - 1; i > cp; --i, --j) {
        if (s[i] != t[j]) {
          f = 1;
          break;
        }
      }
      if (f == 1)
        cout << "NO";
      else
        cout << "YES";
    }
  }
  return 0;
}
