var d = require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n');
var s = d[0];
var s2 = s + s;
var p = d[1];
var exists = false;
for (var i = 0; i < s.length; i++) {
  if (s2.substr(i, p.length) === p) {
    exists = true;
    break;
  }
}
console.log(exists ? 'Yes' : 'No');