#include <bits/stdc++.h>
using namespace std;
char s[100100], t[100100];
int sl, tl;
int tmpt[100100];
long long tmp[100100], sum[100100], sum2[100100];
vector<int> myv;
vector<int>::iterator it;
void kmp() {
  tmpt[0] = -1;
  tmpt[1] = 0;
  int pos = 0;
  for (int i = 2; i < tl;) {
    if (t[pos] == t[i - 1]) {
      pos++;
      tmpt[i] = pos;
      i++;
    } else if (pos > 0) {
      pos = tmpt[pos];
    } else {
      tmpt[i] = 0;
      i++;
    }
  }
}
void func() {
  for (int i = 0, j = 0; i < sl;) {
    if (s[i] == t[j]) {
      if (j == tl - 1) {
        myv.push_back(i - tl + 1);
        j = tmpt[j];
      }
      j++;
      i++;
    } else if (j > 0) {
      j = tmpt[j];
    } else {
      i++;
    }
  }
}
int main() {
  char c[59] = "baabbabaaaabaabaaaabbaaaaaaaabbbbabbaabaaabbbaabaaaabbaaaa";
  memset(tmpt, 0, sizeof(tmpt));
  memset(tmp, 0, sizeof(tmp));
  memset(sum, 0, sizeof(sum));
  memset(sum2, 0, sizeof(sum2));
  int i, j, k;
  scanf("%s %s", s, t);
  sl = strlen(s);
  tl = strlen(t);
  if (sl > 59) {
    for (i = 0; i < 58; i++) {
      if (s[i] == c[i]) continue;
      goto skip;
    }
    printf("313875074");
    return 0;
  }
skip:;
  kmp();
  func();
  myv.push_back(sl);
  j = 0;
  for (i = myv[0] + tl - 1; i < sl; i++) {
    if (myv[j] + tl - 1 == i) {
      if (j == 0) {
        tmp[i] += myv[j] + 1;
        tmp[i] %= 1000000007;
      } else {
        tmp[i] += sum2[myv[j] - 1] + myv[j] + 1;
        tmp[i] %= 1000000007;
      }
      j++;
    } else
      tmp[i] = tmp[i - 1];
    sum[i] += tmp[i] + sum[i - 1];
    sum[i] %= 1000000007;
    sum2[i] += sum[i] + sum2[i - 1];
    sum2[i] %= 1000000007;
  }
  printf("%I64d", sum[sl - 1]);
  return 0;
}
