#include <bits/stdc++.h>
using namespace std;
string s, s2;
int kmp[100005], n, m, match[100005], fen[100005][2], A[100005], B[100005],
    C[100005];
int main() {
  cin >> s;
  cin >> s2;
  n = s.size();
  m = s2.size();
  kmp[0] = -1;
  kmp[1] = 0;
  for (int i = 2, j = 0; i <= m; i++) {
    while (j != -1 && s2[i - 1] != s2[j]) j = kmp[j];
    kmp[i] = ++j;
  }
  for (int i = 1, j = 0; i <= n; i++) {
    while (j != -1 && s2[j] != s[i - 1]) j = kmp[j];
    ++j;
    if (j == m) {
      match[i] = 1;
      j = kmp[j];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!match[i])
      A[i] = A[i - 1];
    else
      A[i] = (C[max(i - m, 0)] * 1ll + i - m + 1 + 1000000007) % 1000000007;
    B[i] = (A[i] * 1ll + B[i - 1]) % 1000000007;
    C[i] = (B[i] * 1ll + C[i - 1]) % 1000000007;
  }
  cout << B[n];
}
