#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50, mod = 1e9 + 7;
string s, t;
int dp[N], f[N], prv[N];
vector<int> computePrefix(string &pat) {
  int m = pat.size();
  vector<int> longestPrefix(m);
  for (int i = 1, k = 0; i < m; i++) {
    while (k > 0 && pat[k] != pat[i]) k = longestPrefix[k - 1];
    if (pat[k] == pat[i])
      longestPrefix[i] = ++k;
    else
      longestPrefix[i] = k;
  }
  return longestPrefix;
}
void KMP(string &str, string &pat) {
  int n = str.size(), m = pat.size();
  vector<int> longestPrefix = computePrefix(pat);
  for (int i = 0, k = 0; i < n; i++) {
    while (k > 0 && pat[k] != str[i]) k = longestPrefix[k - 1];
    if (pat[k] == str[i]) k++;
    if (k == m) {
      prv[i + 1] = i - m + 2;
      k = longestPrefix[k - 1];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> t;
  KMP(s, t);
  int n = s.size();
  for (int i = 1; i <= n; i++)
    if (!prv[i]) prv[i] = prv[i - 1];
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    if (prv[i]) dp[i] = (dp[i] + f[prv[i] - 1] + prv[i]) % mod;
    f[i] = (f[i - 1] + dp[i]) % mod;
  }
  cout << dp[n];
}
