function main(input) {
  var source = input[0];
  var target = input[1];
  
  var flag = false;
  for (var i = 0; i < source.length; i++) {
    var source = shift(source);
    if (source === target) {
      flag = true;
      break;
    }
  }

  console.log(flag ? 'Yes' : 'No');
}

const shift = (str) => {
  if (str.length === 0) {
    return "";
  }

  const tailHead = str.substr(-1);
  const heads = str.substr(0, str.length-1);

  return tailHead + heads;
};

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n'));
