#include <bits/stdc++.h>
using namespace std;
char buf[1 << 21], *p1 = buf, *p2 = buf;
inline int qread() {
  register char c =
      (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
           ? EOF
           : *p1++);
  register int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - 48;
    c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  return x * f;
}
inline int Abs(const int& x) { return (x > 0 ? x : -x); }
inline int Max(const int& x, const int& y) { return (x > y ? x : y); }
inline int Min(const int& x, const int& y) { return (x < y ? x : y); }
const long long mod = 1000000007;
char s[100005], t[100005];
int n, m, fail[100005], prv[100005];
long long dp[100005], sum[100005], sum2[100005];
inline void Read() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
}
inline void Prefix() {
  fail[1] = 0;
  int match = 0;
  for (int i = 2; i <= m; i++) {
    while (match && t[match + 1] != t[i]) match = fail[match];
    if (t[match + 1] == t[i]) match++;
    fail[i] = match;
  }
  match = 0;
  for (int i = 1; i <= n; i++) {
    while (match && t[match + 1] != s[i]) match = fail[match];
    if (t[match + 1] == s[i]) match++;
    if (match == m)
      prv[i] = i - m;
    else
      prv[i] = -1;
  }
}
inline void Solve() {
  for (int i = 2; i <= n; i++) prv[i] = Max(prv[i], prv[i - 1]);
  dp[0] = 1;
  sum[0] = 1;
  sum2[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (prv[i] != -1)
      dp[i] = (sum[prv[i]] + dp[i - 1]) % mod;
    else
      dp[i] = dp[i - 1];
    sum[i] = (sum[i - 1] + dp[i]) % mod;
  }
  printf("%lld", (dp[n] + mod - 1) % mod);
}
int main() {
  Read();
  Prefix();
  Solve();
  return 0;
}
