#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const long long mod = 1e9 + 7;
int n, m, q;
char a[N], b[N];
long long dp[N];
long long sum[N];
int nxt[N], last[N];
void kmp() {
  int i, j;
  for (j = 0, i = 2; i <= n; i++) {
    while (j && a[j + 1] != a[i]) j = nxt[j];
    if (a[j + 1] == a[i]) j++;
    nxt[i] = j;
  }
  int t = 0;
  for (j = 0, i = 1; i <= m; i++) {
    while (j && a[j + 1] != b[i]) j = nxt[j];
    if (a[j + 1] == b[i]) j++;
    if (j == n) {
      j = nxt[j];
      t = i - n + 1;
    }
    dp[i] = (dp[i - 1] + sum[t - 1] + t) % mod;
    sum[i] = (sum[i - 1] + dp[i]) % mod;
  }
}
void solve() {
  scanf("%s %s", b + 1, a + 1);
  n = strlen(a + 1), m = strlen(b + 1);
  kmp();
  printf("%lld", dp[m]);
}
int main() {
  int Case = 1;
  while (Case--) {
    solve();
  }
  return 0;
}
