'use strict'

const main = arg => {
    var input = arg.trim().split("\n");
    const s = input[0] + input[0];
    const p = input[1];

    console.log(s.includes(p) ? "Yes" : "No");
}

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