#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using pq = priority_queue<int>;
const int N = 2e5 + 10, mod = 1e9 + 7;
int n, m;
string s1, s2;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  ;
  cin >> n >> m;
  cin >> s1 >> s2;
  int p = -1;
  bool o1 = false, o2 = true;
  for (int i = 0; i < n; i++)
    if (s1[i] == '*') o1 = true, p = i;
  for (int i = 0; i < m; i++)
    if (s2[i] < 'a' || s2[i] > 'z') o2 = false;
  if (!o2) return cout << "NO", 0;
  if (!o1) {
    if (n == m) {
      for (int i = 0; i < n; i++)
        if (s1[i] != s2[i]) return puts("NO");
      puts("YES");
    } else
      puts("NO");
  } else {
    bool ok = true;
    for (int i = 0; i < p; i++)
      if (s1[i] != s2[i]) ok = false;
    for (int i = n - 1, j = m - 1; i > p; i--, j--)
      if (s1[i] != s2[j]) ok = false;
    if (m + 1 < n) ok = false;
    if (ok)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
