#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int INF = 0x3f3f3f3f;
const int iinf = 1 << 30;
const long long linf = 2e18;
const int MOD = 1000000007;
void print(int x) {
  cout << x << endl;
  exit(0);
}
void PRINT(string x) {
  cout << x << endl;
  exit(0);
}
void douout(double x) { printf("%lf\n", x + 0.0000000001); }
char s[N], t[N];
int nxt[N], val[N], f[N], sum[N];
int n, m;
signed main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  nxt[1] = 0;
  for (int i = 2, j = 0; i <= m; i++) {
    while (j && t[i] != t[j + 1]) j = nxt[j];
    if (t[i] == t[j + 1]) j++;
    nxt[i] = j;
  }
  for (int i = 1, j = 0; i <= n; i++) {
    while (j && s[i] != t[j + 1]) j = nxt[j];
    if (s[i] == t[j + 1]) j++;
    if (j == m) {
      val[i] = i - m + 1;
      j = nxt[j];
    }
  }
  for (int i = 1; i <= n; i++)
    if (!val[i]) val[i] = val[i - 1];
  for (int i = 1; i <= n; i++) {
    f[i] = f[i - 1];
    if (val[i]) f[i] = (f[i] + sum[val[i] - 1] + val[i]) % MOD;
    sum[i] = (sum[i] + sum[i - 1] + f[i]) % MOD;
  }
  printf("%d\n", f[n]);
  return 0;
}
