#include <bits/stdc++.h>
using namespace std;
long long dp[100005];
long long dpp[100005];
long long dppp[100005];
const long long MOD = 1000000007;
int main() {
  string s, p;
  cin >> s >> p;
  vector<int> f(p.length() + 1);
  f[0] = f[1] = 0;
  for (int i = 2; i <= p.length(); i++) {
    int j = i - 1;
    f[i] = 0;
    while (j) {
      j = f[j];
      if (p[j] == p[i - 1]) {
        f[i] = j + 1;
        break;
      }
    }
  }
  vector<int> pos;
  int ci = 0;
  for (int j = 0; j < s.length();) {
    if (s[j] == p[ci]) {
      ci++;
      j++;
      if (ci == p.length()) {
        pos.push_back(j - 1);
      }
    } else if (ci > 0)
      ci = f[ci];
    else
      j++;
  }
  for (int i = 0; i < s.length(); i++) {
    int cp = (int)(lower_bound(pos.begin(), pos.end(), i) - pos.begin());
    int tc = 1000000;
    if (cp != pos.size() && pos[cp] == i) {
      tc = int(i - p.length());
    } else {
      cp--;
      if (cp < 0) continue;
      tc = int(pos[cp] - p.length());
    }
    dp[i] = 0;
    if (tc != 1000000) dp[i] = tc + 2;
    if (tc >= 0 && tc != 1000000) dp[i] += dppp[tc];
    if (i == 0)
      dpp[i] = dp[i];
    else
      dpp[i] = dpp[i - 1] + dp[i];
    if (i == 0)
      dppp[i] = dp[i];
    else
      dppp[i] = dppp[i - 1] + dpp[i];
    dp[i] %= MOD;
    dpp[i] %= MOD;
    dppp[i] %= MOD;
  }
  cout << dpp[s.length() - 1] << endl;
}
