#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int NMAX = 1e5 + 5;
int N, M;
int phi[NMAX];
char s[NMAX], a[NMAX];
bitset<NMAX> match;
int dp[NMAX];
class BinaryIndexedTree {
 public:
  int N;
  int aib[NMAX];
  void init(int _N) {
    N = _N;
    for (int i = 1; i <= N; i++) aib[i] = 0;
  }
  void U(int pos, int val) {
    for (; pos <= N; pos += (pos & (-pos))) aib[pos] = (aib[pos] + val) % mod;
  }
  int Q(int pos) {
    int ans = 0;
    for (; pos > 0; pos -= (pos & (-pos))) ans = (ans + aib[pos]) % mod;
    return ans;
  }
} aib1, aib2;
int main() {
  scanf("%s\n", s + 1);
  scanf("%s\n", a + 1);
  N = strlen(s + 1);
  M = strlen(a + 1);
  int k = 0;
  for (int i = 2; i <= M; i++) {
    while (k > 0 && a[i] != a[k + 1]) k = phi[k];
    if (a[i] == a[k + 1]) k++;
    phi[i] = k;
  }
  k = 0;
  for (int i = 1; i <= N; i++) {
    while (k > 0 && s[i] != a[k + 1]) k = phi[k];
    if (s[i] == a[k + 1]) k++;
    if (k == M) match[i] = 1;
  }
  aib1.init(N), aib2.init(N);
  int lst = -1;
  for (int i = 1; i <= N; i++) {
    if (match[i]) lst = i;
    int K = lst - M;
    dp[i] = 0;
    if (K >= 0) {
      dp[i] = (dp[i] + K + 1) % mod;
      int s1 = aib1.Q(K);
      int s2 = aib2.Q(K);
      int x = (1LL * s1 * (K + 1)) % mod;
      int y = (x - s2 + mod) % mod;
      dp[i] = (dp[i] + y) % mod;
    }
    aib1.U(i, dp[i]);
    aib2.U(i, (1LL * dp[i] * i) % mod);
  }
  int ans = aib1.Q(N);
  printf("%d\n", ans);
  return 0;
}
