#include <bits/stdc++.h>
char s[100003], t[100003];
int pr[100003], match[100003], ls, lt;
int pf[100003], pp[100003], pa[100003];
void calcpre() {
  int k = -1;
  pr[0] = -1;
  for (int i = 0; i < lt;) {
    while (k >= 0 && t[i] != t[k]) k = pr[k];
    pr[++i] = ++k;
  }
}
void kmp() {
  calcpre();
  int k = 0;
  for (int i = 0; i < ls;) {
    while (k >= 0 && s[i] != t[k]) k = pr[k];
    ++i;
    ++k;
    if (k == lt) k = pr[k], match[i] = 1;
  }
}
int main() {
  scanf("%s%s", s, t);
  ls = strlen(s);
  lt = strlen(t);
  kmp();
  pf[0] = pp[0] = 1;
  pa[0] = 0;
  for (int i = 1; i <= ls; ++i) {
    pa[i] = match[i] ? pp[i - lt] : pa[i - 1];
    pf[i] = pf[i - 1] + pa[i];
    pf[i] %= 1000000007LL;
    pp[i] = pp[i - 1] + pf[i];
    pp[i] %= 1000000007LL;
  }
  printf("%d\n", (pf[ls] + 1000000007LL - 1) % 1000000007LL);
  return 0;
}
