#include <bits/stdc++.h>
using namespace std;
int h[100010];
void prepare(char *p) {
  int m = strlen(p + 1);
  h[1] = 0;
  for (int i = 2, j = 0; i <= m; i++) {
    while (j && p[j + 1] != p[i]) j = h[j];
    if (p[j + 1] == p[i]) j++;
    h[i] = j;
  }
  return;
}
vector<int> v;
void kmp_matching(char *t, char *p) {
  int n = strlen(t + 1), m = strlen(p + 1);
  for (int i = 1, j = 0; i <= n; i++) {
    while (j && t[i] != p[j + 1]) j = h[j];
    if (t[i] == p[j + 1]) j++;
    if (j == m) v.push_back(i);
  }
  return;
}
char s[100010], t[100010];
int dp[100010], ep[100010], fp[100010];
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  scanf("%s%s", s + 1, t + 1);
  int n = strlen(s + 1), m = strlen(t + 1);
  prepare(t);
  kmp_matching(s, t);
  dp[0] = ep[0] = fp[0] = 1;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    auto it = lower_bound(v.begin(), v.end(), i + 1);
    if (it != v.begin()) {
      it--;
      int k = *it - m;
      dp[i] = (dp[i] + fp[k]) % mod;
    } else
      dp[i] = 0;
    ep[i] = (ep[i - 1] + dp[i]) % mod;
    fp[i] = (fp[i - 1] + ep[i]) % mod;
    ans = (ans + dp[i]) % mod;
  }
  cout << ans << endl;
  return 0;
}
