#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100010;
char s1[Maxn], s2[Maxn];
const int M = 1e9 + 7;
int ls1, ls2;
int f[Maxn];
bool is[Maxn];
int close[Maxn];
void getf() {
  f[0] = f[1] = 0;
  for (int i = 1; i < ls2; i++) {
    int j = f[i];
    while (j && s2[i] != s2[j]) j = f[j];
    f[i + 1] = s2[i] == s2[j] ? j + 1 : 0;
  }
}
void find() {
  int j = 0;
  for (int i = 0; i < ls1; i++) {
    while (j && s2[j] != s1[i]) j = f[j];
    if (s2[j] == s1[i]) j++;
    if (j == ls2) {
      j = f[j];
      is[i] = 1;
    }
  }
}
void getclose() {
  int cur = -1;
  for (int i = 0; i < ls1; i++) {
    if (is[i]) cur = i;
    close[i] = cur;
  }
}
inline void up(int &x, int y) {
  x += y;
  if (x >= M) x -= M;
}
inline int low(int x) { return x & (-x); }
int Sum1[Maxn], Sum2[Maxn];
int ask(int *x, int loc) {
  loc++;
  int ret = 0;
  for (int i = loc; i >= 1; i -= low(i)) up(ret, x[i]);
  return ret;
}
void add(int *x, int loc, int w) {
  loc++;
  for (int i = loc; i <= ls1; i += low(i)) up(x[i], w);
}
void solve() {
  for (int i = 0; i < ls1; i++) {
    if (close[i] == -1) continue;
    int t = close[i] - ls2;
    int sum1 = ask(Sum1, t), sum2 = ask(Sum2, t);
    int cur = 0;
    up(cur, t + 2);
    up(cur, (t + 1) * (long long)sum1 % M);
    if (t >= 0) up(cur, (M - sum2) % M);
    add(Sum1, i, cur);
    add(Sum2, i, i * (long long)cur % M);
  }
  printf("%d\n", ask(Sum1, ls1 - 1));
}
int main() {
  scanf("%s%s", s1, s2);
  ls1 = strlen(s1);
  ls2 = strlen(s2);
  getf();
  find();
  getclose();
  solve();
}
