#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int mod = 1e9 + 7;
char s[N], t[N];
int n, m, nxt[N], p[N], q[N], f[N], g[N];
int main() {
  int i, k;
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  for (i = 2, k = 0; i <= m; ++i) {
    while (k && t[i] != t[k + 1]) k = nxt[k];
    if (t[i] == t[k + 1]) ++k;
    nxt[i] = k;
  }
  for (i = 1, k = 0; i <= n; ++i) {
    while (k && s[i] != t[k + 1]) k = nxt[k];
    if (s[i] == t[k + 1]) ++k;
    if (k == m) p[i - m] = q[i] = i;
  }
  for (i = 1; i <= n; ++i)
    if (!q[i]) q[i] = q[i - 1];
  for (i = n; i >= 0; --i) {
    if (!p[i]) p[i] = p[i + 1];
    if (p[i])
      f[i] = (1 + g[p[i]] - (long long)f[p[i]] * (m + i - 1) % mod + mod) % mod;
    else
      f[i] = 1;
    g[i] = ((long long)f[i] * q[i] + g[i + 1]) % mod;
    f[i] = (f[i] + f[i + 1]) % mod;
  }
  cout << (f[0] - f[1] + mod - 1) % mod;
  return 0;
}
