#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    if(s.length() != t.length()){
        cout << "No" << endl;
    }
    else{
        int flag = 0;
        for(int i = 0; i < t.length(); i++){
            if(s == t){
                flag = 1;
                break;
            }
            string tmp = "";
            tmp += s[s.length()-1];
            tmp += s;
            tmp.erase(tmp.length()-1);
            s = tmp;
        }
        if(flag) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}
