import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;

void main()
{

    auto s = readln.chomp;
    auto t = readln.chomp;

    foreach (i; 0 .. s.length)
    {
        bool flag = true;
        foreach (k, c; s)
            flag &= (t[(k + i) % t.length] == c);
        if (flag)
        {
            "Yes".writeln;
            return;
        }
    }
    "No".writeln;
}
