#include <bits/stdc++.h>
using namespace std;
vector<long long> z_function(string s) {
  long long n = (long long)s.length();
  vector<long long> z(n);
  for (long long i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
signed main() {
  ios_base::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  string str = t + "#" + s;
  auto z = z_function(str);
  long long n = s.size(), m = t.size();
  long long dp[n], pre1[n], pre2[n];
  for (long long i = 0; i < n; i++) dp[i] = 0, pre1[i] = 0, pre2[i] = 0;
  for (long long i = m - 1; i < n; i++) {
    if (z[i + 2] != m) {
      if (i) dp[i] = dp[i - 1] % 1000000007;
    } else {
      long long pre;
      if (i == m - 1)
        pre = 0;
      else
        pre = pre2[i - m];
      dp[i] = pre + i - m + 2;
      dp[i] %= 1000000007;
    }
    if (i == 0)
      pre1[i] = dp[i];
    else
      pre1[i] = pre1[i - 1] + dp[i];
    if (i == 0)
      pre2[i] = pre1[i];
    else
      pre2[i] = pre2[i - 1] + pre1[i];
    pre1[i] %= 1000000007;
    pre2[i] %= 1000000007;
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += dp[i];
    ans %= 1000000007;
  }
  cout << ans % 1000000007;
}
