'use strict'

function Main(input) {
  const S = input.split('\n')[0];
  const T = input.split('\n')[1];

  const T2 = T + T;

  

  if (T2.indexOf(S) !== -1) {
    console.log('Yes');
  } else {
    console.log('No');
  }

}

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