#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
using namespace std;
int n, m;
string a, b;
int main() {
  int n, m;
  cin >> n >> m >> a >> b;
  if (n - 1 > m) {
    puts("NO");
    return 0;
  }
  int x;
  bool find = false;
  for (x = 0; x < n; x++) {
    if (a[x] == '*') {
      find = true;
      break;
    }
    if (a[x] != b[x]) {
      puts("NO");
      return 0;
    }
  }
  for (int y = n - 1, cnt = m - 1; y > x; y--, cnt--) {
    if (a[y] != b[cnt]) {
      puts("NO");
      return 0;
    }
  }
  if (find == false && n != m) {
    puts("NO");
  } else
    puts("YES");
  return 0;
}
