#!/usr/bin/env python3
while True:

  [k, n] = [int(x) for x in input().split()]
  
  if k == 0  and n == 0:

     break
  
  alphabet = input()
  message = input()

  answer = "Sim"
  for c in message:
    if not c in alphabet:
      answer = "Não"
      break
  print(answer)