import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	}

}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz