function main(input) {
  const args = input.split('\n');
  const S = args[0];
  const N = args[1];
  let ary = S.split('');
  let ans = 'No';
  
  for (let i = 0; i < ary.length; i++) {
    char = ary.splice(0, 1);
    ary.push(char[0]);
    
    chars = ary.join('');
    if (chars === N) { ans = 'Yes'; }
  }
  
  console.log(ans);
  
  
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));