'use strict'
const main = input => {
  const line = input.split('\n')
  const T = line[1]
  let ar = line[0].split('')
  let judgement = 'No'
  for (let i = 0; i < ar.length; i++) {
    const str = ar.join('')
    if (str === T) {
      judgement = 'Yes'
      break
    }
    ar.unshift(ar.pop())
  }
  console.log(judgement)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
