import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;


class Main{
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String b=br.readLine();
		StringBuilder sb=new StringBuilder(str);
		while(sb.length()<101)sb.append(str);
		str=sb.toString();
		System.out.println(str.contains(b)?"Yes":"No");
	
	
	}} import java.io.BufferedReader; BufferedReader java.io import java.io.FileReader; FileReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main{
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String b=br.readLine();
		StringBuilder sb=new StringBuilder(str);
		while(sb.length()<101)sb.append(str);
		str=sb.toString();
		System.out.println(str.contains(b)?"Yes":"No");
	
	
	}} Main public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String b=br.readLine();
		StringBuilder sb=new StringBuilder(str);
		while(sb.length()<101)sb.append(str);
		str=sb.toString();
		System.out.println(str.contains(b)?"Yes":"No");
	
	
	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String b=br.readLine();
		StringBuilder sb=new StringBuilder(str);
		while(sb.length()<101)sb.append(str);
		str=sb.toString();
		System.out.println(str.contains(b)?"Yes":"No");
	
	
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str=br.readLine(); str br.readLine() br.readLine br String b=br.readLine(); b br.readLine() br.readLine br StringBuilder sb=new StringBuilder(str); sb new StringBuilder(str) while(sb.length()<101)sb.append(str); sb.length()<101 sb.length() sb.length sb 101 sb.append(str) sb.append sb str str=sb.toString() str sb.toString() sb.toString sb System.out.println(str.contains(b)?"Yes":"No") System.out.println System.out System System.out str.contains(b)?"Yes":"No" str.contains(b) str.contains str b "Yes" "No" String[] args args
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;


class Main{
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String b=br.readLine();
		StringBuilder sb=new StringBuilder(str);
		while(sb.length()<101)sb.append(str);
		str=sb.toString();
		System.out.println(str.contains(b)?"Yes":"No");
	
	
	}}