inp = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
S = inp.shift()
T = inp.shift()
b = 0
for (i=0; i<S.length; i++) {
    l = S.slice(0, i)
    r = S.slice(i)
    if (r+l == T) {
        b = true
        break;
    }
}
console.log(b ? 'Yes' : 'No')