"use strict";
main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	console.log((lines[0]+lines[0]).indexOf(lines[1]) >= 0 ? "Yes" : "No");
}