#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e6;
const int mod = (int)1e9 + 7;
int p[maxn];
void calc(int m, char *s, int l, int r) {
  p[0] = p[1] = 0;
  for (int i = 2; i <= m; ++i) {
    int j = i - 1;
    while (j && s[i] != s[p[j] + 1]) j = p[j];
    if (s[p[j] + 1] == s[i])
      p[i] = p[j] + 1;
    else
      p[i] = 0;
  }
  for (int i = 1; i <= l; ++i) p[i] = p[i + r + 1];
  return;
}
int m, n, d[maxn], sum[maxn], k;
char s[maxn], t[maxn];
int main() {
  scanf("%s\n", s + 1);
  scanf("%s", t + 1);
  n = (int)strlen(s + 1);
  m = (int)strlen(t + 1);
  t[m + 1] = '#';
  for (int i = 1; i <= n; ++i) t[m + 1 + i] = s[i];
  calc(n + m + 1, t, n, m);
  for (int i = 1; i <= n; i++) {
    if (p[i] == m)
      d[i] = (d[i] + k + i - m + 1) % mod;
    else
      d[i] = d[i - 1];
    sum[i] = (sum[i - 1] + d[i]) % mod;
    if (i >= m) k = (k + sum[i - m + 1]) % mod;
  }
  cout << sum[n] << '\n';
  return 0;
}
