#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  string templ = t + "#" + s;
  vector<long long> pi(templ.size(), 0);
  for (long long i = 1; i < templ.size(); i++) {
    long long j = pi[i - 1];
    while (j > 0 && templ[i] != templ[j]) j = pi[j - 1];
    if (templ[i] == templ[j]) j++;
    pi[i] = j;
  }
  vector<long long> dp(templ.size(), 0);
  vector<long long> prefix_sum(templ.size(), 0);
  vector<long long> prefix_sum2(templ.size(), 0);
  long long last_meeting = -1;
  for (long long i = t.size() + 1; i < templ.size(); i++) {
    if (pi[i] == t.size()) {
      last_meeting = i - (long long)t.size() + 1;
    }
    if (last_meeting != -1) {
      dp[i] =
          prefix_sum2[last_meeting - 1] + last_meeting - (long long)t.size();
      dp[i] %= MOD;
    }
    prefix_sum[i] = (prefix_sum[i - 1] + dp[i]) % MOD;
    prefix_sum2[i] = (prefix_sum2[i - 1] + prefix_sum[i]) % MOD;
  }
  cout << prefix_sum.back() << endl;
}
