#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int top;
int fail[100005], q[100005];
char t[100005], s[100005];
long long ans;
long long f[100005], sum[100005];
bool mark[100005];
int main() {
  scanf("%s", t + 1);
  scanf("%s", s + 1);
  int l1 = strlen(t + 1), l2 = strlen(s + 1);
  int k = 0;
  for (int i = 2; i <= l2; i++) {
    while (k > 0 && s[k + 1] != s[i]) k = fail[k];
    if (s[k + 1] == s[i]) k++;
    fail[i] = k;
  }
  k = 0;
  for (int i = 1; i <= l1; i++) {
    while (k > 0 && s[k + 1] != t[i]) k = fail[k];
    if (s[k + 1] == t[i]) k++;
    if (k == l2) k = fail[k], mark[i] = 1;
  }
  int last = -1;
  for (int i = 1; i <= l1; i++) {
    f[i] = f[i - 1];
    if (mark[i]) last = i - l2 + 1;
    if (last != -1) f[i] += sum[last - 1] + last;
    sum[i] = sum[i - 1] + f[i];
    f[i] %= 1000000007;
    sum[i] %= 1000000007;
  }
  printf("%I64d", f[l1]);
  return 0;
}
