import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

        System.out.println((eq ? "Yes" : "No"));
    }

    private static void rotate(char[] ch) {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    }

    private static boolean equals(char[] left, char[] right) {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    }
}
/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