var input = ""
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
 
process.stdin.on('end', function() {
  input = input.split("\n");

  p = input[0] + input[0]
  s = input[1]

  if (p.indexOf(s) !== -1) {
    console.log("Yes");
  } else {
    console.log("No");
  }
});