#include <bits/stdc++.h>
using namespace std;
const int mxN = 2e5;
const int MOD = 1e9 + 7;
template <typename ForwardIterator, typename T>
ForwardIterator first_less_than(ForwardIterator first, ForwardIterator last,
                                T value) {
  auto it = std::lower_bound(first, last, value);
  return (it == first ? last : --it);
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    long long n, m, i, j, k;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    bool ok = true, cross = false;
    long long insert = -1;
    for (i = 0; i < n; i++) {
      if (s[i] == '*') {
        insert = i;
        cross = true;
        break;
      } else {
        if (s[i] != t[i]) {
          ok = false;
          break;
        }
      }
    }
    if (!cross) {
      if (s == t)
        cout << "YES"
             << "\n";
      else
        cout << "NO"
             << "\n";
      continue;
    }
    if (!ok) {
      cout << "NO"
           << "\n";
      continue;
    }
    string temp;
    for (i = insert + 1; i < n; i++) {
      temp += s[i];
    }
    if (temp.size() != 0) {
      j = m - 1;
      for (i = temp.size() - 1; i >= 0; i--, j--) {
        if (j < insert) {
          ok = false;
          break;
        }
        if (temp[i] != t[j]) {
          ok = false;
          break;
        }
      }
    }
    if (ok)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
}
