'use strict'

function main(input) {

  const t = input.split('\n')[1];
  const s = input.split('\n')[0];

  let str = s;
  let ans  = false;

  for (let i = 0; i < s.length; i++) {
    if (str === t) {
      ans = true;
      break;
    } else {
      str = str.slice(1) + str.slice(0, 1);
    }
  }

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

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