#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
long long int mod = 1e9 + 7, dp[N], cum[N];
string s, t;
int apper[N], f[N], last = -1;
void search() {
  int len = 0;
  for (int i = 0; i < s.size(); ++i) {
    while (len > 0 && s[i] != t[len]) len = f[len - 1];
    if (s[i] == t[len]) ++len;
    if (len == t.size()) {
      apper[i - len + 1] = 1;
      last = (i - len + 1);
      len = f[len - 1];
    }
  }
}
void build() {
  int len = 0;
  f[0] = 0;
  for (int i = 1; i < t.size(); ++i) {
    while (len > 0 && t[i] != t[len]) len = f[len - 1];
    if (t[i] == t[len]) ++len;
    f[i] = len;
  }
}
int main() {
  cin >> s >> t;
  build();
  search();
  long long int ans = 0;
  if (last == -1) return cout << ans, 0;
  ans = s.size() - (last + (t.size() - 1));
  dp[last] = ans % mod;
  cum[last] = ans;
  for (int i = last - 1; i >= 0; i--) {
    if (apper[i]) last = i;
    dp[i] = (1 + dp[i + 1]) % mod;
    int idx = last + t.size();
    long long int plus = (cum[idx] % mod + (s.size() - idx) % mod) % mod;
    dp[i] += plus % mod;
    cum[i] = (cum[i + 1] + dp[i]) % mod;
  }
  cout << dp[0] % mod;
  return 0;
}
