#include <bits/stdc++.h>
int gcd(int a, int b) {
  int r = 1;
  while (r != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
void revStr(char *str) {
  int size = strlen(str);
  int i, j;
  char tmp = {0};
  for (i = 0, j = size - 1; i < size / 2; i++, j--) {
    tmp = str[i];
    str[i] = str[j];
    str[j] = tmp;
  }
  return;
}
typedef struct {
  int a, b;
} data;
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int comp(const void *c1, const void *c2) {
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}
int kai(int n) {
  if (n == 0) {
    return 1;
  }
  int sum = 1;
  for (int i = 1; i <= n; i++) {
    sum *= i;
  }
  return sum;
}
int main() {
  char a[120], b[120];
  scanf("%s", a);
  scanf("%s", b);
  for (int i = 0; i < strlen(a); i++) {
    a[strlen(a)] = a[0];
    for (int j = 0; j < strlen(a); j++) {
      a[j] = a[j + 1];
    }
    a[strlen(a)] = 0;
    if (strcmp(a, b) == 0) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
}
