import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


bool calc(string s, string t) {
    auto n = s.length;
    s = s ~ s;
    for (int i = 0; i < n; i++) {
        if (s[i..i+n] == t)
            return true;
    }
    return false;
}

void main() {
    auto s = readln.chomp;
    auto t = readln.chomp;
    writeln(calc(s, t) ? "Yes" : "No");
}
