n, k = map(int, input().split()) l = n-k s = [input() for _ in range(n)][l:k] t = [input() for _ in range(n)][l:k] print("Yes" if s == t else "No")