#include <bits/stdc++.h>
using namespace std;
string s, t;
int pi[100050], N, M, sum[100050], sum2[100050], pr[100050], K = 0, dp[100050];
void make_prefix() {
  int i, q = 0;
  for (i = 2, pi[1] = 0; i <= M; i++) {
    while (q && t[q + 1] != t[i]) q = pi[q];
    if (t[q + 1] == t[i]) ++q;
    pi[i] = q;
  }
}
int main() {
  cin >> s;
  cin.ignore();
  cin >> t;
  int i, q = 0, l, r, mid;
  N = s.length();
  M = t.length();
  for (i = N; i > 0; i--) s[i] = s[i - 1];
  for (i = M; i > 0; i--) t[i] = t[i - 1];
  make_prefix();
  for (i = 1; i <= N; i++) {
    while (q && t[q + 1] != s[i]) q = pi[q];
    if (t[q + 1] == s[i]) q++;
    if (q == M) {
      q = pi[M];
      pr[++K] = i - M + 1;
    }
  }
  dp[0] = 1;
  sum[0] = 1;
  sum2[0] = 1;
  for (i = 1; i <= N; i++) {
    l = 1, r = K;
    if (i - pr[1] + 1 < M) {
      sum[i] = sum[i - 1];
      sum2[i] = (sum[i] + sum2[i - 1]) % 1000000007LL;
      continue;
    }
    while (r - l > 1) {
      mid = (l + r) / 2;
      if (i - pr[mid] + 1 < M)
        r = mid - 1;
      else
        l = mid;
    }
    if (i - pr[l + 1] + 1 >= M && l + 1 <= K) l++;
    dp[i] = sum2[pr[l] - 1];
    sum[i] = (sum[i - 1] + dp[i]) % 1000000007LL;
    sum2[i] = (sum2[i - 1] + sum[i]) % 1000000007LL;
  }
  cout << (sum[N] - 1 + 1000000007LL) % 1000000007LL;
  return 0;
}
