#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int inf = 1e18;
string s1, t;
vector<long long int> arr, brr, cum, cum1;
void computeLPSArray(long long int M, long long int *lps) {
  long long int len = 0, i = 1;
  lps[0] = 0;
  while (i < M) {
    if (t[i] == t[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len != 0) {
        len = lps[len - 1];
      } else {
        lps[i] = 0;
        i++;
      }
    }
  }
}
void KMPSearch(void) {
  long long int M = t.size(), N = s1.size(), lps[M], i = 0, j = 0;
  computeLPSArray(M, lps);
  while (i < N) {
    if (t[j] == s1[i]) {
      j++;
      i++;
    }
    if (j == M) {
      arr.push_back(i - j + M);
      j = lps[j - 1];
    } else if (i < N && t[j] != s1[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i = i + 1;
    }
  }
}
int main(void) {
  cin >> s1;
  cin >> t;
  long long int ini = 1, last = 0;
  brr.resize(s1.size() + 1, 0);
  cum.resize(s1.size() + 1, 0);
  cum1.resize(s1.size() + 1, 0);
  KMPSearch();
  for (long long int i = 0; i < arr.size(); i++) {
    for (long long int j = ini; j < arr[i]; j++) {
      brr[j] = last;
      cum[j] = (cum[j - 1] + brr[j]) % mod;
      cum1[j] = (cum1[j - 1] + cum[j]) % mod;
    }
    ini = arr[i] + 1;
    brr[arr[i]] = (cum1[arr[i] - t.size()] + arr[i] - t.size() + 1) % mod;
    cum[arr[i]] = (cum[arr[i] - 1] + brr[arr[i]]) % mod;
    cum1[arr[i]] = (cum1[arr[i] - 1] + cum[arr[i]]) % mod;
    last = brr[arr[i]];
  }
  for (long long int j = ini; j < s1.size() + 1; j++) {
    brr[j] = last;
    cum[j] = (cum[j - 1] + brr[j]) % mod;
    cum1[j] = (cum1[j - 1] + cum[j]) % mod;
  }
  cout << cum[s1.size()] << " ";
}
