#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  int pos = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] == '*') {
      pos = i;
      break;
    }
  }
  if (pos == -1) {
    if (m != n) {
      cout << "NO" << endl;
      return 0;
    }
    int f = 1;
    for (int i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
    return 0;
  }
  int f = 1;
  for (int i = 0; i < pos; i++) {
    if (s[i] != t[i]) {
      f = 0;
    }
  }
  int p = m - 1;
  for (int i = n - 1; i > pos; i--) {
    if (s[i] != t[p]) {
      f = 0;
      break;
    }
    p--;
  }
  if (f == 1 && m >= n - 1) {
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
