#include<algorithm>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<valarray>
#include<vector>
#include<map>
#include<list>
#include<bitset>
#include<stdio.h>
#include<sstream>
#include<string>
#include<functional>
#include<utility>
using namespace std;
using ll = long long;
using uint = unsigned;
using llu = long long unsigned int;
using vec = vector<int>;
using val = valarray<int>;

template<class iterator_t>
class range
{
	iterator_t _first, _last;
public:
	range(iterator_t first, iterator_t last) :_first(first), _last(last) {}
	iterator_t begin() { return _first; }
	iterator_t end() { return _last; }
	reverse_iterator<iterator_t> rbegin() { return std::make_reverse_iterator(_last); }
	reverse_iterator<iterator_t> rend() { return std::make_reverse_iterator(_first); }
	size_t size() { return std::distance(_first, _last); }
};
template<class T>T begin(range<T> _range) { return _range.begin(); }
template<class T>T end(range<T> _range) { return _range.end(); }
template<class T>T rbegin(range<T> _range) { return _range.rbegin(); }
template<class T>T rend(range<T> _range) { return _range.rend(); }

string to_string(bool _Val) { return (_Val) ? "true" : "false"; }

struct start { start() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }start;

inline void in() {}

template <class Head, class... Tail>
inline void in(Head&& head, Tail&&... tail) { cin >> head;	in(move(tail)...); }

template <class T>
inline void in(range<T> _range) { for (auto&&i : _range) in(i); }

template <char split = '\n', class T>
inline void out(T t) { cout << t << split; }

template <char split = ' ', class Head, class... Tail>
inline void out(Head head, Tail... tail) { out<split>(head); out(move(tail)...); }

template <char split = '\n', class T>
inline void out(range<T> _range) { for (auto&& bg = _range.begin(), &&ed = _range.end(); cout << *bg++, bg != ed; cout << split) {}cout << endl; }
#define all(x) begin(x),end(x)
#define rall(x) rbegin(x),rend(x)
#define allrange(x) range(all(x))
#define abs(a) ((a) < 0 ? - (a) : (a))
#define rep_(n) for(int i##n =0;i##n <n;++i##n)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define reps(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define rreps(i,n) for(int i=n;i>0;--i)
#define each(i,ary) for(auto&& i:ary)
#define loop(i,l,r) for(int i=(l);i<r;++i)
#define declare_i(...) int __VA_ARGS__;in(__VA_ARGS__);
#define chmax(max,num) (max)=((max)<(num))?(num):(max);
#define chmin(min,num) (min)=((num)<(min))?(num):(min);
#define ary_sum(ary) accumulate(all(ary),0)
#define ary_max(ary) (*max_element(all(ary)))
#define ary_min(ary) (*min_element(all(ary)))
#define ERASE(ary,target) ary.erase(remove(all(ary), target), ary.end())
#define UNIQUE(ary) ary.erase(unique(all(ary)), ary.end() )
#define tmax(type) numeric_limits<type>::max()
#define tmin(type) numeric_limits<type>::min() 
#ifdef LOCAL
#define dump(items) for(auto&& item:items){cout<<item<<endl;}
#define dumps(...) for(auto&& item:{__VA_ARGS__}){cout<<item<<endl;}
#define STOP scanf_s("%*s");return 0;
#else
#define dump(...)
#define dumps(...)
#define STOP return 0;
#endif

int main()
{
	string str1, str2; in(str1, str2);
	str1 += str1; 
	if (search(all(str1), all(str2)) != str1.end())
		out("Yes");
	else 
		out("No");
	STOP;
}


Measured memory_bytes: 256