"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});
/* 入力は 
vanceknowledgetoad
advance

vanceknowledgetoad
advanced
 */

reader.on('close', () => {
    var txt = lines[0];
    var str = lines[1];

    var txt2=txt + txt;
    var re=new RegExp(str);

    if (re.test(txt2)) {
	console.log("Yes");
    } else {
	console.log("No");
    }

});
