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

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

bool calc(string s, string t) {
    auto s2 = s ~ s;

    int p = 0;
    foreach (c; t) {
        bool found = false;
        for (int i = p; i < s2.length; i++) {
            if (s2[i] == c) {
                p = i + 1;
                found = true;
                break;
            }
        }

        if (!found)
            return false;
    }
    return true;
}

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