#include <bits/stdc++.h>
using namespace std;
long long dp[100010], f[100010];
long long sum[100010], e[100010];
char a[100010], b[100010];
bool vi[100010];
void getNext() {
  int n, j, i;
  j = -1;
  f[0] = -1;
  n = strlen(b);
  for (i = 1; i < n; i++) {
    while (j >= 0 && b[j + 1] != b[i]) j = f[j];
    if (b[j + 1] == b[i]) j++;
    f[i] = j;
  }
}
void KMP() {
  int n, m, i, j;
  j = -1;
  getNext();
  n = strlen(a);
  m = strlen(b);
  memset(vi, 0, sizeof(vi));
  for (i = 0; i < n; i++) {
    while (j >= 0 && b[j + 1] != a[i]) j = f[j];
    if (b[j + 1] == a[i]) j++;
    if (j == m - 1) {
      vi[i] = true;
    }
  }
}
int main() {
  int i, n, m, j, k, id;
  int T, case1 = 0, len;
  while (scanf("%s%s", a, b) != EOF) {
    KMP();
    n = strlen(a);
    m = strlen(b);
    memset(dp, 0, sizeof(dp));
    memset(sum, 0, sizeof(sum));
    memset(e, 0, sizeof(e));
    int ans = 0;
    if (m == 1 && a[0] == b[0]) {
      dp[0] = 1;
      sum[0] = 1;
      e[0] = 1;
      ans++;
    }
    for (i = 1; i < n; i++) {
      dp[i] = dp[i - 1];
      if (vi[i]) {
        dp[i] = i - m + 2;
        if (i == m - 1)
          ;
        else {
          dp[i] += e[i - m];
          dp[i] %= 1000000007;
        }
      }
      ans += dp[i];
      ans %= 1000000007;
      sum[i] = sum[i - 1] + dp[i];
      sum[i] %= 1000000007;
      e[i] = e[i - 1] + sum[i];
      e[i] %= 1000000007;
    }
    cout << ans << endl;
  }
  return 0;
}
