'use strict';

function main(arg) {
    const origin = arg.split("\n")[0];
    let   target = arg.split("\n")[1].split("");
    
    for(let i=0; i<target.length; i++) {
        if(origin == target.join("")) {
            console.log("Yes");
            return;
        }
        
        target.unshift(target[target.length-1]);
        target.pop();
    }
    
    console.log("No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));