const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/);
const str = input[0] + input[0];
let substring = input[1];
let regexp = new RegExp(substring);

if (regexp.test(str)) {
     console.log('Yes');
    } else {
     console.log('No');
    }

