function main(input) {
  let args = input.split("\n");
  let s = args[0].trim();
  let n = s.length;
  let p = args[1].trim();
  s = s + s;

  let is_ok = false;
  for (let i = 0; i < n; i++) {
    if (s.substring(i, i + p.length) === p) {
      is_ok = true;
    }
  }
  console.log(is_ok ? "Yes" : "No");
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
