#include <iostream>

int main() {
    std::string S, T;
    std::cin >> S;
    std::cin >> T;

    if ((S + S).find(T) != std::string::npos) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}
