#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const long long mod = 1e9 + 7;
char s[maxn], t[maxn];
int Next[maxn], sign[maxn], len1, len2;
long long sum1[maxn], sum2[maxn];
void getnext() {
  for (int i = 1; i < len2; i++) {
    int j = Next[i];
    while (j && t[i] != t[j]) j = Next[j];
    Next[i + 1] = (t[i] == t[j] ? j + 1 : 0);
  }
}
void kmp() {
  int j = 0;
  for (int i = 1; i <= len1; i++) {
    while (j && s[i] != t[j]) j = Next[j];
    if (s[i] == t[j]) j++;
    if (j == len2) {
      sign[i] = i - len2 + 1;
    }
  }
}
int main() {
  scanf("%s%s", s + 1, t);
  len1 = strlen(s + 1);
  len2 = strlen(t);
  getnext();
  kmp();
  for (int i = 1; i <= len1; i++) {
    if (sign[i] == 0) sign[i] = sign[i - 1];
  }
  for (int i = 1; i <= len1; i++) {
    if (sign[i] == 0) continue;
    sum1[i] = (sum1[i - 1] + sum2[sign[i] - 1] + sign[i]) % mod;
    sum2[i] = (sum2[i - 1] + sum1[i]) % mod;
  }
  printf("%I64d\n", sum1[len1]);
  return 0;
}
