#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 10, mod = 1000000007;
string s, t;
int f[maxn], cur, last = -1;
long long dp[maxn], sum[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin >> s >> t;
  for (int i = 2; i <= t.length(); i++) {
    while (cur && t[i - 1] != t[cur]) cur = f[cur];
    if (t[i - 1] == t[cur]) cur++;
    f[i] = cur;
  }
  cur = 0;
  for (int i = 0; i < s.length(); i++) {
    while (cur && s[i] != t[cur]) cur = f[cur];
    if (s[i] == t[cur]) cur++;
    dp[i + 1] = dp[i];
    if (cur == t.length()) {
      last = i - t.length() + 1;
      cur = f[cur];
    }
    if (last != -1) dp[i + 1] = (dp[i + 1] + sum[last] + last + 1) % mod;
    sum[i + 1] = (sum[i] + dp[i + 1]) % mod;
  }
  cout << dp[s.length()];
  return 0;
}
