import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

// (1) ?????????s???????????????
// (2) ?????????p???????????????
// (3) ?????????s?????????????????????sMatrix?????¨?????????
// (4) ?????????p?????????????????????pMatrix?????¨?????????
// (5) ?????????s???????????°?????????1??????????????\?????????????????????
	// (5.1) ????±???¨??????1?????????Char??????????????????
	// (5.2) ????????????????????§????????????????¢????????????´????????\?????????????????????
		// (5.2.1) ?????????????????????
	// (5.3) ?????????p???????????°?????????1??????????????\?????????????????????
		// (5.3.1) ????±???¨??????1?????????Char??????????????????
		// (5.3.2)

// ????????°????????£??????????????´???

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz