#include <bits/stdc++.h>
using namespace std;
using DB = double;
using LL = long long;
using PII = pair<int, int>;
void err() { puts(""); }
template <template <typename...> class T, typename t, typename... Args>
void err(T<t> a, Args... args) {
  for (auto x : a) cout << x << ' ';
  err(args...);
}
template <typename T, typename... Args>
void err(T a, Args... args) {
  cout << a << ' ';
  err(args...);
}
const int N = 2e5 + 10;
char s[N], t[N];
void work() {
  int n, m;
  scanf("%d%d%s%s", &n, &m, s, t);
  int id = -1;
  for (int i = 0; i < n; i++)
    if (s[i] == '*') id = i;
  if (id == -1) {
    printf("%s\n", strcmp(s, t) == 0 ? "YES" : "NO");
  } else {
    bool flag = 0;
    if (n - 1 <= m) {
      flag = 1;
      for (int i = 0; i < id; i++) {
        if (s[i] != t[i]) flag = 0;
      }
      for (int i = n - 1, j = m - 1; i > id; i--, j--) {
        if (s[i] != t[j]) flag = 0;
      }
    }
    printf("%s\n", flag ? "YES" : "NO");
  }
}
int main() {
  work();
  return 0;
}
