#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int mod = 1e9 + 7;
int n, m, dp[N], sum[N], fail[N], last[N];
char s[N], t[N];
void cal() {
  fail[1] = 0;
  for (int i = 2; i <= m; i++) {
    int j = fail[i - 1];
    while (j && t[j + 1] != t[i]) j = fail[j];
    fail[i] = (t[j + 1] == t[i]) ? j + 1 : 0;
  }
}
void kmp() {
  int ps = 1, pt = 1;
  while (ps <= n) {
    if (s[ps] == t[pt])
      ps++, pt++;
    else {
      if (pt == 1)
        ps++;
      else
        pt = fail[pt - 1] + 1;
    }
    if (pt > m) {
      last[ps - 1] = ps - m;
      pt = fail[pt - 1] + 1;
    }
  }
}
int main() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  cal();
  kmp();
  for (int i = 1; i <= n; i++)
    if (!last[i]) last[i] = last[i - 1];
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    int k = last[i];
    if (k) dp[i] = (dp[i] + sum[k - 1]) % mod;
    dp[i] = (dp[i] + k) % mod;
    sum[i] = (sum[i - 1] + dp[i]) % mod;
  }
  printf("%d\n", dp[n]);
  return 0;
}
